Submission #57538


ソースコード

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#include<bits/stdc++.h>
#define INF 9223372036854775807LL
#define inf 1000000007
#define SYOU(x) setprecision(x+1)
#define abs(x,y) (max(x,y)-min(x,y))
#define lol long long
#define mp make_pair
#define fi first
#define se second
using namespace std;
int a,b;
signed main(){
cin.tie(0);
ios::sync_with_stdio(false);
lol c;
int ans=5;
cin >>a>>b>>c;
if(a>b) swap(a,b);
for(int n=1;n<=sqrt(c);n++){
if(c%n==0){
if(n<=a&&(c/n)<=b){
if(ans>2) ans=2;
if(n==a){
if((c/n)==b) ans=0;
else if(ans>1) ans=1;
} else if((c/n)==b&&ans>1) ans=1;
}
}
}
if(ans==5) cout <<"-1\n";
else cout <<ans<<'\n';
return (0);
}

ステータス

項目 データ
問題 1228 - Chocolate
ユーザー名 ei1923
投稿日時 2019-12-18 16:37:10
言語 C++14
状態 Accepted
得点 100
ソースコード長 703 Byte
最大実行時間 35 ms
最大メモリ使用量 736 KB

セット

セット 得点 Cases
1 task1 30 / 30 in01*
2 task2 70 / 70 in*

テストケース

ファイル名 状態 実行時間 メモリ使用量 #
in01-01.txt AC 25 ms 604 KB
1
2
in01-02.txt AC 16 ms 432 KB
1
2
in01-03.txt AC 21 ms 388 KB
1
2
in01-04.txt AC 16 ms 596 KB
1
2
in01-05.txt AC 23 ms 552 KB
1
2
in01-06.txt AC 21 ms 636 KB
1
2
in01-07.txt AC 24 ms 588 KB
1
2
in01-08.txt AC 19 ms 540 KB
1
2
in01-09.txt AC 24 ms 624 KB
1
2
in01-10.txt AC 25 ms 580 KB
1
2
in01-11.txt AC 21 ms 532 KB
1
2
in01-12.txt AC 25 ms 616 KB
1
2
in01-13.txt AC 31 ms 700 KB
1
2
in01-14.txt AC 20 ms 528 KB
1
2
in02-01.txt AC 29 ms 612 KB
2
in02-02.txt AC 34 ms 568 KB
2
in02-03.txt AC 19 ms 648 KB
2
in02-04.txt AC 23 ms 604 KB
2
in02-05.txt AC 22 ms 560 KB
2
in02-06.txt AC 23 ms 516 KB
2
in02-07.txt AC 24 ms 600 KB
2
in02-08.txt AC 24 ms 556 KB
2
in02-09.txt AC 30 ms 512 KB
2
in02-10.txt AC 27 ms 592 KB
2
in02-11.txt AC 17 ms 672 KB
2
in02-12.txt AC 23 ms 628 KB
2
in02-13.txt AC 25 ms 580 KB
2
in02-14.txt AC 14 ms 656 KB
2
in02-15.txt AC 25 ms 736 KB
2
in02-16.txt AC 23 ms 564 KB
2
in02-17.txt AC 26 ms 520 KB
2
in02-18.txt AC 27 ms 604 KB
2
in02-19.txt AC 23 ms 564 KB
2
in02-20.txt AC 35 ms 652 KB
2
sample01.txt AC 18 ms 604 KB
sample02.txt AC 21 ms 560 KB
sample03.txt AC 21 ms 640 KB