結果
問題 | No.358 も~っと!門松列 |
ユーザー |
|
提出日時 | 2016-04-17 22:33:54 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 1,000 ms |
コード長 | 992 bytes |
コンパイル時間 | 876 ms |
コンパイル使用メモリ | 104,228 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-10-10 23:56:51 |
合計ジャッジ時間 | 1,694 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 23 |
ソースコード
#define _USE_MATH_DEFINES #include <cstdio> #include <iostream> #include <sstream> #include <fstream> #include <iomanip> #include <algorithm> #include <cmath> #include <complex> #include <string> #include <vector> #include <list> #include <queue> #include <stack> #include <set> #include <map> #include <bitset> #include <numeric> #include <limits> #include <climits> #include <cfloat> #include <functional> using namespace std; bool checkKadomatsu(const vector<int>& a) { if(a[0] == a[2]) return false; return (a[0] < a[1] && a[2] < a[1]) || (a[0] > a[1] && a[2] > a[1]); } int main() { vector<int> a(3); for(int i=0; i<3; ++i) cin >> a[i]; if(checkKadomatsu(a)){ cout << "INF" << endl; return 0; } int ans = 0; for(int p=1; p<=1000; ++p){ vector<int> b(3); for(int i=0; i<3; ++i) b[i] = a[i] % p; if(checkKadomatsu(b)) ++ ans; } cout << ans << endl; return 0; }