結果
| 問題 | 
                            No.2127 Mod, Sum, Sum, Mod
                             | 
                    
| コンテスト | |
| ユーザー | 
                             tails
                         | 
                    
| 提出日時 | 2023-03-16 15:04:50 | 
| 言語 | C90  (gcc 12.3.0)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 5 ms / 2,000 ms | 
| コード長 | 287 bytes | 
| コンパイル時間 | 841 ms | 
| コンパイル使用メモリ | 22,528 KB | 
| 実行使用メモリ | 5,376 KB | 
| 最終ジャッジ日時 | 2024-09-18 09:21:20 | 
| 合計ジャッジ時間 | 1,911 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge1 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 27 | 
コンパイルメッセージ
main.c:9:1: warning: return type defaults to ‘int’ [-Wimplicit-int]
    9 | main(){
      | ^~~~
main.c: In function ‘main’:
main.c:11:9: warning: implicit declaration of function ‘scanf’ [-Wimplicit-function-declaration]
   11 |         scanf("%d%d",&n,&i);
      |         ^~~~~
main.c:1:1: note: include ‘<stdio.h>’ or provide a declaration of ‘scanf’
  +++ |+#include <stdio.h>
    1 | typedef __int128_t t;
main.c:11:9: warning: incompatible implicit declaration of built-in function ‘scanf’ [-Wbuiltin-declaration-mismatch]
   11 |         scanf("%d%d",&n,&i);
      |         ^~~~~
main.c:11:9: note: include ‘<stdio.h>’ or provide a declaration of ‘scanf’
main.c:11:17: warning: format ‘%d’ expects argument of type ‘int *’, but argument 2 has type ‘t *’ {aka ‘__int128 *’} [-Wformat=]
   11 |         scanf("%d%d",&n,&i);
      |                ~^    ~~
      |                 |    |
      |                 |    t * {aka __int128 *}
      |                 int *
main.c:11:19: warning: format ‘%d’ expects argument of type ‘int *’, but argument 3 has type ‘t *’ {aka ‘__int128 *’} [-Wformat=]
   11 |         scanf("%d%d",&n,&i);
      |                  ~^     ~~
      |                   |     |
      |                   int * t * {aka __int128 *}
main.c:18:9: warning: implicit declaration of function ‘printf’ [-Wimplicit-function-declaration]
   18 |         printf("%d",a%998244353);
      |         ^~~~~~
main.c:18:9: note: include ‘<stdio.h>’ or provide a declaration of ‘printf’
main.c:18:9: warning: incompatible implicit declaration of built-in function ‘printf’ [-Wbuiltin-declaration-mismatch]
main.c:18:9: note: include ‘<stdio.h>’ or provide a declaration of ‘printf’
main.c:18:18: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘t’ {aka ‘__int128’} [-Wformat=]
   18 |         printf("%d",a%998244353);
      |                 ~^  ~~~~~
            
            ソースコード
typedef __int128_t t;
t f(t i,t n,t v){
	t i2=i*(i+1)/2;
	t i3=i2*(i*2+1)/3;
	t n2=n*(n+1)/2;
	t v2=v*(v+1)/2;
	return i*n2-i2*(n+1)*v+i3*v2;
}
main(){
	t n=0,i=0,a=0,v;
	scanf("%d%d",&n,&i);
	while(i){
		v=n/i;
		a+=f(i,n,v);
		i=n/(v+1);
		a-=f(i,n,v);
	}
	printf("%d",a%998244353);
}
            
            
            
        
            
tails