結果
| 問題 |
No.2624 Prediction by Average
|
| コンテスト | |
| ユーザー |
chro_96
|
| 提出日時 | 2024-02-09 22:16:37 |
| 言語 | C (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 5 ms / 2,000 ms |
| コード長 | 850 bytes |
| コンパイル時間 | 147 ms |
| コンパイル使用メモリ | 30,592 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-09-28 15:31:55 |
| 合計ジャッジ時間 | 553 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 5 |
ソースコード
#include <stdio.h>
int main () {
int t = 0;
long long n = 0LL;
char s[8] = "";
int res = 0;
res = scanf("%d", &t);
while (t > 0) {
long long ans = 0LL;
long long sd = 0LL;
int idx = 0;
int p = -1;
res = scanf("%lld", &n);
res = scanf("%s", s);
while (s[idx] != '\0') {
if (s[idx] == '.') {
p = idx;
} else {
sd *= 10LL;
sd += (long long)(s[idx]-'0');
}
idx++;
}
if (p < 0) {
sd *= 1000LL;
} else if (idx-p == 2) {
sd *= 100LL;
} else if (idx-p == 3) {
sd *= 10LL;
}
for (long long i = 1LL; i <= 1000LL; i += 1LL) {
if (i <= n && (1000LL-(i*sd)%1000LL)%1000LL < i) {
ans += 1LL;
}
}
if (n > 1000LL) {
ans += n-1000LL;
}
printf("%lld\n", ans);
t--;
}
return 0;
}
chro_96