Submission #44924
ソースコード
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 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 | // to Utils -> L47 // to Rlyeh -> L78 #include <iostream> #include <string> #include <stack> #include <queue> #include <cstring> #include <algorithm> #include <vector> #include <cstdio> #include <cmath> #include <cstdlib> #include <functional> #include <map> #include <numeric> using namespace std; #define class struct #define constexpr const #define bogo_sort sort #define bozo_sort stable_sort #define elif else if #define echo cout << #define read cin >> #define fin << '\n' #define unless(flg) if(!(flg)) #define elless(flg) else if(!(flg)) #define alles(obj) obj.begin(), obj.end() #define bash push_back #define makePair make_pair // type-define #define String string #define Stack stack #define Queue queue #define pQueue priority_queue #define Vector vector #define Pair pair #define Map map typedef long long llong; typedef bool boolean; typedef Pair< int , int > Pii; typedef Vector< int > Vi; // utils constexpr int dx[] = {1, 0, -1, 0, 1, 1, -1, -1}; constexpr int dy[] = {0, 1, 0, -1, 1, -1, 1, -1}; constexpr int INF = 1 << 29; class Utils { static llong power ( llong x, llong n, llong mod ) { llong ans = 1; while ( n > 0 ) { if ( n & 1 ) { ans = ( ans * x ) % mod; } x = ( x * x ) % mod; n >>= 1; } return ans; } static llong power ( llong x, llong n ) { return power( x, n, 1000000007 ); } static llong gcd ( llong x, llong y ) { return x % y ? gcd( y, x % y ) : y; } static llong lcm ( llong x, llong y ) { return ( x / gcd(x, y) * y ); } static boolean isMovable ( int x, int y, int w, int h ) { return ( x >= 0 && y >= 0 && x < w && y < h ); } }; namespace Rlyeh { llong day; llong svd; signed call_of_Cthulhu( signed datum ) { llong a, b, t; read a >> b >> t; for ( int i = 1; i < INF; i++ ) { day++; svd += a; if ( t <= svd ) { echo day fin; return 0; } llong diffToNext = i * 2; if ( svd + ( diffToNext * b ) < t ) { day += diffToNext; svd += diffToNext * b; } else { while ( !(t <= svd) ) { day++; svd += b; } echo day fin; return 0; } } return 0; } } signed main(){cin.tie(0); ios::sync_with_stdio( false ); Rlyeh::call_of_Cthulhu(114514); return 0;} |
ステータス
項目 | データ |
---|---|
問題 | 0993 - 貯金 (Saving Money) |
ユーザー名 | r1825 |
投稿日時 | 2018-11-14 22:53:21 |
言語 | C++14 |
状態 | Accepted |
得点 | 10 |
ソースコード長 | 2693 Byte |
最大実行時間 | 33 ms |
最大メモリ使用量 | 728 KB |
セット
セット | 得点 | Cases | |
---|---|---|---|
1 | ALL | 10 / 10 | * |
テストケース
ファイル名 | 状態 | 実行時間 | メモリ使用量 | # |
---|---|---|---|---|
input-sample01 | AC | 20 ms | 600 KB |
1
|
input-sample02 | AC | 29 ms | 432 KB |
1
|
input-sample03 | AC | 17 ms | 392 KB |
1
|
input01 | AC | 24 ms | 472 KB |
1
|
input02 | AC | 24 ms | 432 KB |
1
|
input03 | AC | 23 ms | 516 KB |
1
|
input04 | AC | 23 ms | 604 KB |
1
|
input05 | AC | 26 ms | 564 KB |
1
|
input06 | AC | 31 ms | 648 KB |
1
|
input07 | AC | 24 ms | 480 KB |
1
|
input08 | AC | 28 ms | 560 KB |
1
|
input09 | AC | 26 ms | 640 KB |
1
|
input10 | AC | 30 ms | 588 KB |
1
|
input11 | AC | 26 ms | 416 KB |
1
|
input12 | AC | 24 ms | 620 KB |
1
|
input13 | AC | 26 ms | 704 KB |
1
|
input14 | AC | 25 ms | 532 KB |
1
|
input15 | AC | 25 ms | 488 KB |
1
|
input16 | AC | 22 ms | 444 KB |
1
|
input17 | AC | 24 ms | 656 KB |
1
|
input18 | AC | 25 ms | 612 KB |
1
|
input19 | AC | 22 ms | 568 KB |
1
|
input20 | AC | 22 ms | 652 KB |
1
|
input21 | AC | 20 ms | 604 KB |
1
|
input22 | AC | 21 ms | 432 KB |
1
|
input23 | AC | 17 ms | 644 KB |
1
|
input24 | AC | 28 ms | 728 KB |
1
|
input25 | AC | 25 ms | 684 KB |
1
|
input26 | AC | 24 ms | 636 KB |
1
|
input27 | AC | 26 ms | 720 KB |
1
|
input28 | AC | 26 ms | 672 KB |
1
|
input29 | AC | 25 ms | 624 KB |
1
|
input30 | AC | 33 ms | 708 KB |
1
|