結果
| 問題 | No.634 硬貨の枚数1 |
| コンテスト | |
| ユーザー |
bal4u
|
| 提出日時 | 2019-05-01 11:37:37 |
| 言語 | C (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 350 bytes |
| 記録 | |
| コンパイル時間 | 625 ms |
| コンパイル使用メモリ | 30,848 KB |
| 実行使用メモリ | 6,824 KB |
| 最終ジャッジ日時 | 2024-12-31 12:15:36 |
| 合計ジャッジ時間 | 3,110 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 9 WA * 66 |
ソースコード
// yukicoder: No.634 硬貨の枚数1
// 2019.5.1 bal4u
#include <stdio.h>
#include <math.h>
int calc(int n)
{
int b = (int)sqrt(1.0+(double)(n << 3));
return (b-1) >> 1;
}
int main()
{
int a, k, N, ans;
scanf("%d", &N);
ans = 0; while (N) {
k = calc(N);
a = k*(k+1) >> 1;
ans += N / a, N %= a;
}
printf("%d\n", ans);
return 0;
}
bal4u