結果
| 問題 |
No.358 も~っと!門松列
|
| コンテスト | |
| ユーザー |
bal4u
|
| 提出日時 | 2019-05-19 08:26:50 |
| 言語 | C (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 1 ms / 1,000 ms |
| コード長 | 608 bytes |
| コンパイル時間 | 140 ms |
| コンパイル使用メモリ | 29,568 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-09-17 06:26:18 |
| 合計ジャッジ時間 | 1,117 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 23 |
ソースコード
// yukicoder: 358 も~っと!門松列
// 2019.5.19 bal4u
#include <stdio.h>
int check(int A, int B, int C) {
if (A == C) return 0;
if (B == A || B == C) return 0;
if (A < C) {
if (B < A || B > C) return 1;
} else {
if (B > A || B < C) return 1;
}
return 0;
}
int main()
{
int A, B, C, p, max, ans;
scanf("%d%d%d", &A, &B, &C);
if (A == C) { puts("0"); return 0; }
if (check(A, B, C)) { puts("INF"); return 0; }
max = A;
if (B > max) max = B;
if (C > max) max = C;
ans = 0; for (p = 1; p <= max; p++) {
if (check(A % p, B % p, C % p)) ans++;
}
printf("%d\n", ans);
return 0;
}
bal4u