Submission #57375
ソースコード
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 34 35 36 37 38 39 40 41 42 43 44 | //header{{{ #include<bits/stdc++.h> using namespace std; #define rep(i,n) for(int i=0;i<(n);++i) #define reps(i,n) for(int i=1;i<=(n);++i) #define all(x) (x).begin(),(x).end() #define setout(n,x) setw(n+1) << setfill(x) #define Fixed fixed << setprecision(10) #define int int64_t using pii = pair< int , int >; constexpr int INF = 0x3f3f3f3f; constexpr long long LINF = 0x3f3f3f3f3f3f3f3fLL; constexpr int mod = 1e9+7; template < class A, class B> inline bool chmax(A &a, const B &b) { return b > a && (a = b, true ); } template < class A, class B> inline bool chmin(A &a, const B &b) { return b < a && (a = b, true ); } template < class T> using min_heap = priority_queue<T,vector<T>,greater<T> >; template < class T> using max_heap = priority_queue<T>; int gcd( int a, int b){ return b ? gcd(b,a % b) : a;} int lcm( int a, int b){ return a / gcd(a,b) * b;} //}}} signed main(){ cin.tie(0); ios::sync_with_stdio( false ); int H,W,N; cin >> H >> W >> N; int minv = INF; for ( int i = 1;i * i <= N;++i){ if (N % i == 0){ int a = i,b = N / i; if ((a == H && b == W) || (b == H && a == W)) chmin(minv,0); else if ((a == H && b < W) || (a < H && b == W) || (b == H && a < W) || (b < H && a == W)) chmin(minv,1); else if ((a < H && b < W) || (b < H && a < W)) chmin(minv,2); } } cout << (minv == INF ? -1 : minv) << '\n' ; return 0; } |
ステータス
項目 | データ |
---|---|
問題 | 1228 - Chocolate |
ユーザー名 | ei1903 |
投稿日時 | 2019-12-15 14:15:01 |
言語 | C++14 |
状態 | Accepted |
得点 | 100 |
ソースコード長 | 1477 Byte |
最大実行時間 | 31 ms |
最大メモリ使用量 | 764 KB |
セット
セット | 得点 | Cases | |
---|---|---|---|
1 | task1 | 30 / 30 | in01* |
2 | task2 | 70 / 70 | in* |
テストケース
ファイル名 | 状態 | 実行時間 | メモリ使用量 | # | |
---|---|---|---|---|---|
in01-01.txt | AC | 27 ms | 600 KB |
1
|
2
|
in01-02.txt | AC | 24 ms | 688 KB |
1
|
2
|
in01-03.txt | AC | 17 ms | 648 KB |
1
|
2
|
in01-04.txt | AC | 31 ms | 604 KB |
1
|
2
|
in01-05.txt | AC | 22 ms | 432 KB |
1
|
2
|
in01-06.txt | AC | 29 ms | 388 KB |
1
|
2
|
in01-07.txt | AC | 17 ms | 596 KB |
1
|
2
|
in01-08.txt | AC | 23 ms | 552 KB |
1
|
2
|
in01-09.txt | AC | 22 ms | 504 KB |
1
|
2
|
in01-10.txt | AC | 17 ms | 464 KB |
1
|
2
|
in01-11.txt | AC | 28 ms | 672 KB |
1
|
2
|
in01-12.txt | AC | 25 ms | 628 KB |
1
|
2
|
in01-13.txt | AC | 27 ms | 712 KB |
1
|
2
|
in01-14.txt | AC | 29 ms | 668 KB |
1
|
2
|
in02-01.txt | AC | 17 ms | 624 KB |
2
|
|
in02-02.txt | AC | 27 ms | 580 KB |
2
|
|
in02-03.txt | AC | 17 ms | 664 KB |
2
|
|
in02-04.txt | AC | 20 ms | 616 KB |
2
|
|
in02-05.txt | AC | 20 ms | 572 KB |
2
|
|
in02-06.txt | AC | 22 ms | 524 KB |
2
|
|
in02-07.txt | AC | 17 ms | 480 KB |
2
|
|
in02-08.txt | AC | 31 ms | 568 KB |
2
|
|
in02-09.txt | AC | 27 ms | 648 KB |
2
|
|
in02-10.txt | AC | 29 ms | 600 KB |
2
|
|
in02-11.txt | AC | 23 ms | 680 KB |
2
|
|
in02-12.txt | AC | 17 ms | 764 KB |
2
|
|
in02-13.txt | AC | 21 ms | 724 KB |
2
|
|
in02-14.txt | AC | 30 ms | 552 KB |
2
|
|
in02-15.txt | AC | 23 ms | 632 KB |
2
|
|
in02-16.txt | AC | 23 ms | 716 KB |
2
|
|
in02-17.txt | AC | 28 ms | 672 KB |
2
|
|
in02-18.txt | AC | 27 ms | 624 KB |
2
|
|
in02-19.txt | AC | 19 ms | 708 KB |
2
|
|
in02-20.txt | AC | 24 ms | 660 KB |
2
|
|
sample01.txt | AC | 20 ms | 740 KB | ||
sample02.txt | AC | 17 ms | 696 KB | ||
sample03.txt | AC | 24 ms | 524 KB |