結果
| 問題 |
No.1273 はじめのζ関数
|
| コンテスト | |
| ユーザー |
👑 |
| 提出日時 | 2020-10-31 12:11:30 |
| 言語 | C (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 703 bytes |
| コンパイル時間 | 396 ms |
| コンパイル使用メモリ | 31,232 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-07-22 04:53:45 |
| 合計ジャッジ時間 | 1,616 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 39 WA * 1 |
ソースコード
#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 = 100, 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 = 100, tmp = 0.0; j >= 1; j--) tmp += powl(j, -i);
ans += tmp - 1.0;
}
for (j = 100, 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;
}