結果
| 問題 |
No.2117 中国剰余定理入門
|
| コンテスト | |
| ユーザー |
chro_96
|
| 提出日時 | 2022-11-04 21:27:27 |
| 言語 | C (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 503 bytes |
| コンパイル時間 | 100 ms |
| コンパイル使用メモリ | 28,800 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-07-18 19:11:30 |
| 合計ジャッジ時間 | 755 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 20 |
ソースコード
#include <stdio.h>
int main () {
int b0 = 0;
int c0 = 0;
int b1 = 0;
int c1 = 0;
int res = 0;
int ans = 0;
res = scanf("%d", &b0);
res = scanf("%d", &c0);
res = scanf("%d", &b1);
res = scanf("%d", &c1);
if (c0 < 0) {
c0 += (1+(-c0)/b0)*b0;
}
if (c1 < 0) {
c1 += (1+(-c1)/b1)*b1;
}
while (ans < b0*b1) {
if (ans%b0 == c0%b0 && ans%b1 == c1%b1) {
printf("%d\n", ans);
return 0;
}
ans++;
}
printf("NaN\n");
return 0;
}
chro_96