結果
問題 | No.278 連続する整数の和(2) |
ユーザー | tails |
提出日時 | 2020-12-11 20:22:34 |
言語 | C (gcc 12.3.0) |
結果 |
AC
|
実行時間 | 6 ms / 2,000 ms |
コード長 | 435 bytes |
コンパイル時間 | 579 ms |
コンパイル使用メモリ | 30,464 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-09-19 21:28:57 |
合計ジャッジ時間 | 859 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 1 ms
6,816 KB |
testcase_01 | AC | 1 ms
6,944 KB |
testcase_02 | AC | 5 ms
6,940 KB |
testcase_03 | AC | 1 ms
6,944 KB |
testcase_04 | AC | 1 ms
6,944 KB |
testcase_05 | AC | 1 ms
6,944 KB |
testcase_06 | AC | 1 ms
6,940 KB |
testcase_07 | AC | 1 ms
6,940 KB |
testcase_08 | AC | 4 ms
6,944 KB |
testcase_09 | AC | 4 ms
6,944 KB |
testcase_10 | AC | 6 ms
6,940 KB |
testcase_11 | AC | 5 ms
6,944 KB |
testcase_12 | AC | 1 ms
6,944 KB |
testcase_13 | AC | 4 ms
6,944 KB |
testcase_14 | AC | 3 ms
6,944 KB |
testcase_15 | AC | 3 ms
6,940 KB |
testcase_16 | AC | 3 ms
6,944 KB |
testcase_17 | AC | 4 ms
6,944 KB |
コンパイルメッセージ
main.c:6:1: warning: return type defaults to 'int' [-Wimplicit-int] 6 | main(){ | ^~~~ main.c: In function 'main': main.c:8:9: warning: implicit declaration of function 'scanf' [-Wimplicit-function-declaration] 8 | scanf("%ld",&n); | ^~~~~ main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf' +++ |+#include <stdio.h> 1 | #pragma GCC optimize("Ofast") main.c:8:9: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch] 8 | scanf("%ld",&n); | ^~~~~ main.c:8:9: note: include '<stdio.h>' or provide a declaration of 'scanf' main.c:11:16: warning: implicit declaration of function 'sqrt' [-Wimplicit-function-declaration] 11 | long s=sqrt(n); | ^~~~ main.c:1:1: note: include '<math.h>' or provide a declaration of 'sqrt' +++ |+#include <math.h> 1 | #pragma GCC optimize("Ofast") main.c:11:16: warning: incompatible implicit declaration of built-in function 'sqrt' [-Wbuiltin-declaration-mismatch] 11 | long s=sqrt(n); | ^~~~ main.c:11:16: note: include '<math.h>' or provide a declaration of 'sqrt' main.c:35:9: warning: implicit declaration of function 'printf' [-Wimplicit-function-declaration] 35 | printf("%ld",z); | ^~~~~~ main.c:35:9: note: include '<stdio.h>' or provide a declaration of 'printf' main.c:35:9: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch] main.c:35:9: note: include '<stdio.h>' or provide a declaration of 'printf'
ソースコード
#pragma GCC optimize("Ofast") #pragma GCC target("avx2") char old[1500000]; main(){ long n; scanf("%ld",&n); n>>=~n&1; long s=sqrt(n); long z=1; while((n&1)==0){ z=z*2+1; n>>=1; } for(long i=3;i<=s;i+=2){ if(!old[i]){ if(n%i==0){ long y=1; do{ y=y*i+1; n/=i; }while(n%i==0); z*=y; } for(long j=i*i;j<=s;j+=i*2){ old[j]=1; } } } if(n>1){ z*=n+1; } printf("%ld",z); }