Submission #44919


ソースコード

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
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,n) for(int i=0;i<n;i++)
#define why(n,x) int n;while(cin >>n,n!=x)
#define iFOR(i,x,n)for(int i=x;i<n;i++)
#define unless(flg) if ( !(flg) )
#define read cin<<
#define echo cout<<
#define fin <<'\n'
#define __ <<" "<<
#define bash push_back
#define all(x) x.begin(),x.end()
#define itn int
int dx[]={1,0,-1,0,1,1,-1,-1};
int dy[]={0,-1,0,1,-1,1,-1,1};
const int INF=1 << 30;
bool inside(int x,int y,int w,int h){
return (x>=0 && y>=0 && x<w && y<h);}
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vit;
typedef map<string,int> mstit;
typedef priority_queue<int> pqit;
itn a,b;
ll t;
int main(){
cin.tie(0), ios::sync_with_stdio(false);
cin >>a>>b>>t;
ll ans=0;
ll old=0;
ll day=0;
for(ll i = 1;ans < t ;i++){
ans+=(i*i-old-1)*b + a;
old=i*i;
}
if(ans>=t){
ans-=a;
old--;
while(ans>=t){
ans-=b;
old--;
}
}
cout <<old+1 fin;
return 0;
}

ステータス

項目 データ
問題 0993 - 貯金 (Saving Money)
ユーザー名 ei1821
投稿日時 2018-11-14 22:37:45
言語 C++14
状態 Accepted
得点 10
ソースコード長 1036 Byte
最大実行時間 40 ms
最大メモリ使用量 728 KB

セット

セット 得点 Cases
1 ALL 10 / 10 *

テストケース

ファイル名 状態 実行時間 メモリ使用量 #
input-sample01 AC 40 ms 604 KB
1
input-sample02 AC 28 ms 692 KB
1
input-sample03 AC 28 ms 648 KB
1
input01 AC 20 ms 476 KB
1
input02 AC 17 ms 556 KB
1
input03 AC 18 ms 512 KB
1
input04 AC 17 ms 600 KB
1
input05 AC 22 ms 692 KB
1
input06 AC 18 ms 520 KB
1
input07 AC 30 ms 600 KB
1
input08 AC 18 ms 560 KB
1
input09 AC 19 ms 524 KB
1
input10 AC 22 ms 484 KB
1
input11 AC 19 ms 440 KB
1
input12 AC 18 ms 524 KB
1
input13 AC 20 ms 604 KB
1
input14 AC 22 ms 428 KB
1
input15 AC 18 ms 644 KB
1
input16 AC 17 ms 604 KB
1
input17 AC 17 ms 684 KB
1
input18 AC 20 ms 512 KB
1
input19 AC 34 ms 716 KB
1
input20 AC 19 ms 544 KB
1
input21 AC 18 ms 632 KB
1
input22 AC 21 ms 588 KB
1
input23 AC 17 ms 540 KB
1
input24 AC 18 ms 492 KB
1
input25 AC 20 ms 700 KB
1
input26 AC 20 ms 656 KB
1
input27 AC 29 ms 612 KB
1
input28 AC 19 ms 688 KB
1
input29 AC 22 ms 644 KB
1
input30 AC 36 ms 728 KB
1