結果
問題 | No.1273 はじめのζ関数 |
ユーザー |
👑 |
提出日時 | 2020-10-31 12:14:12 |
言語 | C (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 4 ms / 2,000 ms |
コード長 | 703 bytes |
コンパイル時間 | 223 ms |
コンパイル使用メモリ | 31,104 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-07-22 04:53:55 |
合計ジャッジ時間 | 1,433 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 40 |
ソースコード
#include <stdio.h> #include <math.h> int main() { int i, j, x; long double ans = 0.0, tmp; scanf("%d", &x); if (x == 2) printf("1000000\n"); else if (x >= 5) { for (i = 50; i >= x; i--) { for (j = 200, tmp = 0.0; j >= 1; j--) tmp += powl(j, -i); ans += tmp - 1.0; } printf("%d\n", (int)(ans * 1000000)); } else { for (i = 50; i >= 5; i--) { for (j = 200, tmp = 0.0; j >= 1; j--) tmp += powl(j, -i); ans += tmp - 1.0; } for (j = 500, tmp = 0.0; j >= 1; j--) tmp += powl(j, -4); ans += tmp - 1.0; if (x <= 3) { for (j = 1000, tmp = 0.0; j >= 1; j--) tmp += powl(j, -3); ans += tmp - 1.0; } printf("%d\n", (int)(ans * 1000000)); } fflush(stdout); return 0; }