結果
問題 | No.358 も~っと!門松列 |
ユーザー |
|
提出日時 | 2018-03-14 17:35:25 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 1,000 ms |
コード長 | 613 bytes |
コンパイル時間 | 1,528 ms |
コンパイル使用メモリ | 166,292 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-28 02:27:45 |
合計ジャッジ時間 | 2,366 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 23 |
ソースコード
#include <bits/stdc++.h>using namespace std;int main(){int i;int A1;int A2;int A3;int B1;int B2;int B3;int iCnt;cin >> A1;cin >> A2;cin >> A3;if( A1 == A2 || A1 == A3 || A2 == A3 ){cout << 0 << endl;return 0;}else if( ( A1 < A2 && A2 > A3 ) ||( A1 > A2 && A2 < A3 ) ){cout << "INF" << endl;return 0;}iCnt = 0;for( i = 2; i <= 1000; i++ ){B1 = A1 % i;B2 = A2 % i;B3 = A3 % i;if( B1 == B2 || B1 == B3 || B2 == B3 )continue;if( ( B1 < B2 && B2 > B3 ) ||( B1 > B2 && B2 < B3 ) )iCnt++;}cout << iCnt << endl;return 0;}