Submission #00005


ソースコード

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include<bits/stdc++.h>
using namespace std;
int x,p;
int main(){
cin>>x>>p;
int ans=x%p;
x-=ans;
int cnt=0;
for(int i=p;i>=1;i--){
if(x==0)break;
int t=1;
for(int j=0;j<i;j++)t*=p;
ans+=x/t;
x=x%t;
// cout<<x<<endl;
i=min(i,x/p+1);
// cout<<i<<endl;
}
cout<<ans<<endl;
}

ステータス

項目 データ
問題 0003 - おもり
ユーザー名 社畜解放宣言
投稿日時 2016-11-11 16:31:54
言語 C++11
状態 Runtime Error
得点 0
ソースコード長 342 Byte
最大実行時間 47 ms
最大メモリ使用量 480 KB

セット

セット 得点 Cases
1 ALL 0 / 100 *

テストケース

ファイル名 状態 実行時間 メモリ使用量 #
00.in RE 47 ms 480 KB
1
01.in RE 24 ms 472 KB
1
02.in RE 31 ms 460 KB
1
03.in RE 26 ms 452 KB
1
04.in RE 20 ms 444 KB
1
05.in RE 23 ms 428 KB
1