結果
問題 | No.278 連続する整数の和(2) |
ユーザー |
![]() |
提出日時 | 2016-12-11 16:54:46 |
言語 | C90 (gcc 12.3.0) |
結果 |
AC
|
実行時間 | 7 ms / 2,000 ms |
コード長 | 537 bytes |
コンパイル時間 | 266 ms |
コンパイル使用メモリ | 20,992 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-12-23 09:12:50 |
合計ジャッジ時間 | 749 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 18 |
コンパイルメッセージ
main.c: In function ‘run’: main.c:7:3: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 7 | scanf("%lld",&n); | ^~~~~~~~~~~~~~~~
ソースコード
#include<stdio.h> typedef long long int ln; void run(void){ ln n; scanf("%lld",&n); if(n%2==0){ n/=2; } ln ans=1; ln k=2; ln t=1; while(n%k==0){ t*=k; n/=k; } ans*=2*t-1; k=3; t=1; while(n%k==0){ t*=k; n/=k; } ans*=(k*t-1)/(k-1); int add=2; k=5; while(k*k<=n){ t=1; while(n%k==0){ t*=k; n/=k; } ans*=(k*t-1)/(k-1); k+=add; add^=6; } if(n>1){ ans*=n+1; } printf("%lld\n",ans); return; } int main(void){ run(); return 0; }