結果
問題 | No.358 も~っと!門松列 |
ユーザー | fmhr |
提出日時 | 2016-04-17 23:15:30 |
言語 | C++14 (gcc 13.2.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 2 ms / 1,000 ms |
コード長 | 1,073 bytes |
コンパイル時間 | 1,489 ms |
コンパイル使用メモリ | 165,416 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-04-19 07:18:57 |
合計ジャッジ時間 | 2,266 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
6,812 KB |
testcase_01 | AC | 2 ms
6,940 KB |
testcase_02 | AC | 2 ms
6,940 KB |
testcase_03 | AC | 2 ms
6,944 KB |
testcase_04 | AC | 2 ms
6,940 KB |
testcase_05 | AC | 2 ms
6,944 KB |
testcase_06 | AC | 2 ms
6,944 KB |
testcase_07 | AC | 2 ms
6,940 KB |
testcase_08 | AC | 2 ms
6,940 KB |
testcase_09 | AC | 2 ms
6,940 KB |
testcase_10 | AC | 2 ms
6,940 KB |
testcase_11 | AC | 2 ms
6,944 KB |
testcase_12 | AC | 2 ms
6,940 KB |
testcase_13 | AC | 2 ms
6,944 KB |
testcase_14 | AC | 1 ms
6,940 KB |
testcase_15 | AC | 2 ms
6,940 KB |
testcase_16 | AC | 1 ms
6,940 KB |
testcase_17 | AC | 2 ms
6,944 KB |
testcase_18 | AC | 2 ms
6,940 KB |
testcase_19 | AC | 1 ms
6,940 KB |
testcase_20 | AC | 2 ms
6,940 KB |
testcase_21 | AC | 2 ms
6,940 KB |
testcase_22 | AC | 2 ms
6,940 KB |
ソースコード
#include <bits/stdc++.h> using namespace std; #define _GLIBCXX_DEBUG #define dump(c) cerr << "> " << #c << " = " << (c) << endl #define all(c) ((c).begin()), ((c).end()) #define rep(i,n) for(int i=0;i<(int)n;i++) #define FOR(i,s,e) for(int (i)=(int)(s);(i)<(int)(e);++(i)) #define inf 0x3f3f3f3f #define infl 0x3f3f3f3f3f3f3f3fLL typedef long long ll; typedef unsigned long long ull; bool isDiff(int a, int b, int c){ if (a==b || b==c || c==a) return false; return true; } bool isKadomatsu(int a, int b, int c){ return (isDiff(a,b,c) && ((a > b && c > b)||(a < b && c < b))); } int main() { cin.tie(0); ios::sync_with_stdio(false); int A1, A2, A3; cin >> A1 >> A2 >> A3; if (!isDiff(A1, A2, A3)){ cout << "0" << endl; }else if (isKadomatsu(A1, A2, A3)){ cout << "INF" << endl; }else{ int counter = 0; int m = max(A1, max(A2, A3)); for (int i = 1; i <= m; ++i) { if (isKadomatsu(A1%i, A2%i, A3%i)) counter++; } cout << counter << endl; } return 0; }