結果
問題 |
No.358 も~っと!門松列
|
ユーザー |
![]() |
提出日時 | 2023-04-08 22:50:59 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 1,000 ms |
コード長 | 587 bytes |
コンパイル時間 | 692 ms |
コンパイル使用メモリ | 69,172 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-10-03 20:08:58 |
合計ジャッジ時間 | 1,626 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 23 |
ソースコード
#include<iostream> #include<cmath> using namespace std; bool kadomatsu(int A1, int A2, int A3) { if (A1 != A2 && A2 != A3 && A3 != A1) { if (max(max(A1, A2), A3) == A2 || min(min(A1, A2), A3) == A2) return true; } return false; } int main() { int a1, a2, a3; cin >> a1 >> a2 >> a3; if (kadomatsu(a1, a2, a3)) cout << "INF" << endl; else { int res = 0; for (int i = 1; i <= 1000; i++) { int b1 = a1 % i, b2 = a2 % i, b3 = a3 % i; if (kadomatsu(b1, b2, b3)) res++; } cout << res << endl; } }