#include <stdio.h>
#include <algorithm>
#include <iostream>
#include <vector>
#include <assert.h>
#include <map>
#include <set>
#include <stdlib.h>
#include <math.h>
#include <string>
#include <time.h>
#include <string.h>
#include <queue>
#include <complex>
#include <iomanip>
#include <stack>
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
typedef complex<double> base;
ll mod=1e9+7;
double eps=1e-9;
ll exp(ll x,ll y){if(y<0) return 0; ll ret=1;for(;y;y>>=1,x=(x*x)%mod){if(y&1)ret=(ret*x)%mod;}return ret;}
ll pexp(ll x, ll y){if(y<0) return 0; ll ret=1; for(;y;y>>=1,x=(x*x)){if(y&1)ret=(ret*x);}return ret;}
ll gcd(ll x,ll y){if(!x||!y) return x+y; return x%y==0?y:gcd(y,x%y);}
ll lcm(ll x,ll y){return x*(y/gcd(x,y));}
ll bsum(ll u,ll b){ll ret=0;if(u<b)return u;while(u){ret+=u%b;u/=b;}return ret;}
ll prival(ll u,ll p){ll cn=0;while(u%p==0){cn++;u=u/p;}return cn;}
ll minv(ll a,ll b){return 1<a?b-minv(b%a,a)*b/a:1;}
ll extm(ll a,ll b){ll ret=0;while(a!=0){if(a%2==1){ret+=b;ret%=mod;}a>>=1;b=(2*b)%mod;}return ret;}
ll eaphi(ll x){ll t=x,ret=x,i;for(i=2;i*i<=x;i++){if(t%i==0){ret-=ret/i;while(t%i==0) t/=i;}}if(t!=1) ret-=ret/t;return ret;}
ll eadivc(ll x){ll ret=0;ll i;for(i=1;i*i<=x;i++){if(x%i==0 && i*i!=x) ret+=2;if(x%i==0 && i*i==x) ret+=1;}return ret;}
ll ndig(ll x, ll b){ll ret=0;while(x){x/=b; ret++;}return ret;}
bool isprime(ll x){if(x<=1) return false; for(ll i=2;i*i<=x;i++){if(x%i==0){return false;}}return true;}
ll n, j, r, t;
ll stf[1111];
ll resv[1111];
int main(void)
{
cin>>n>>j>>r>>t;
int i;
for(i=1 ; i<=n ; i++) stf[i]=j;
while(t--)
{
for(i=1 ; i<=n ; i++)
{
if(i!=n) resv[i+1]=(stf[i]+r-1)/r;
if(i!=n) stf[i]-=(stf[i]+r-1)/r;
}
for(i=1 ; i<=n ; i++) stf[i]+=resv[i];
}
for(i=1 ; i<=n ; i++) printf("%lld\n",stf[i]);
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
340 KB |
Output is correct |
2 |
Correct |
2 ms |
488 KB |
Output is correct |
3 |
Correct |
3 ms |
488 KB |
Output is correct |
4 |
Correct |
2 ms |
504 KB |
Output is correct |
5 |
Correct |
2 ms |
504 KB |
Output is correct |
6 |
Correct |
4 ms |
504 KB |
Output is correct |
7 |
Correct |
29 ms |
504 KB |
Output is correct |
8 |
Correct |
45 ms |
664 KB |
Output is correct |
9 |
Correct |
48 ms |
700 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
340 KB |
Output is correct |
2 |
Correct |
2 ms |
488 KB |
Output is correct |
3 |
Correct |
3 ms |
488 KB |
Output is correct |
4 |
Correct |
2 ms |
504 KB |
Output is correct |
5 |
Correct |
2 ms |
504 KB |
Output is correct |
6 |
Correct |
4 ms |
504 KB |
Output is correct |
7 |
Correct |
29 ms |
504 KB |
Output is correct |
8 |
Correct |
45 ms |
664 KB |
Output is correct |
9 |
Correct |
48 ms |
700 KB |
Output is correct |
10 |
Runtime error |
3 ms |
740 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
11 |
Halted |
0 ms |
0 KB |
- |