結果

問題 No.358 も~っと!門松列
ユーザー akun0716akun0716
提出日時 2018-10-20 23:06:28
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 681 bytes
コンパイル時間 751 ms
コンパイル使用メモリ 58,144 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-08-12 05:27:04
合計ジャッジ時間 2,408 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,384 KB
testcase_01 AC 1 ms
4,384 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 1 ms
4,384 KB
testcase_04 AC 2 ms
4,384 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 2 ms
4,384 KB
testcase_07 AC 2 ms
4,384 KB
testcase_08 AC 1 ms
4,384 KB
testcase_09 AC 2 ms
4,380 KB
testcase_10 AC 1 ms
4,380 KB
testcase_11 AC 1 ms
4,384 KB
testcase_12 AC 2 ms
4,380 KB
testcase_13 AC 1 ms
4,380 KB
testcase_14 AC 1 ms
4,384 KB
testcase_15 AC 2 ms
4,384 KB
testcase_16 AC 2 ms
4,384 KB
testcase_17 AC 1 ms
4,380 KB
testcase_18 AC 2 ms
4,384 KB
testcase_19 AC 1 ms
4,384 KB
testcase_20 AC 2 ms
4,380 KB
testcase_21 AC 2 ms
4,384 KB
testcase_22 AC 2 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include <algorithm>
using namespace std;
int max(int s,int t,int z){
	if(z>s && z>t)
		return z;
	if(s>z && s>t)
		return s;
	if(t>s && t>z)
		return t;
	
	return 0;
}
int main(){

	int a,b,c;
	int co=0;
	cin>>a>>b>>c;
	if(b>a && b>c){
		if(a!=c){
			cout<<"INF"<<endl;;
			return 0;
		}
		if(a==c){
			cout<<"0"<<endl;
			return 0;
		}
	}
	if(b<a && b<c){
		if(a!=c){
			cout<<"INF"<<endl;
			return 0;
		}
		if(a==c){
			cout<<"0"<<endl;
			return 0;
		}
	}
		int s=max(a,b,c);
	for(int i=1;i<=s;i++){
		int x=a%i;
		int y=b%i;
		int z=c%i;
		if(x>y && z>y){
			if(x!=z)
			co++;
		}
		if(y>z && y>x){
			if(x!=z)
			co++;
		}
	}
	cout<<co<<endl;
	return 0;
}
0