結果
問題 | No.358 も~っと!門松列 |
ユーザー |
![]() |
提出日時 | 2016-04-17 22:40:56 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 1,000 ms |
コード長 | 750 bytes |
コンパイル時間 | 476 ms |
コンパイル使用メモリ | 59,668 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-10-04 10:38:19 |
合計ジャッジ時間 | 1,162 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 23 |
ソースコード
#include <iostream>#include <vector>#include <algorithm>using namespace std;#define RREP(i,s,e) for (i = s; i >= e; i--)#define rrep(i,n) RREP(i,n,0)#define REP(i,s,e) for (i = s; i < e; i++)#define rep(i,n) REP(i,0,n)#define INF 100000000typedef long long ll;int main() {int i;int a[3];rep (i,3) cin >> a[i];if (a[0] == a[2])cout << 0 << endl;else if (a[1] < min(a[0],a[2]) || a[1] > max(a[0],a[2]))cout << "INF" << endl;else {int cnt = 0;REP (i,2,*max_element(a,a+3)+1) {if (a[0]%i != a[2]%i && (a[1]%i < min(a[0]%i,a[2]%i) || a[1]%i > max(a[0]%i,a[2]%i))) {cnt++;}}cout << cnt << endl;}return 0;}