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