提出 #4830896
ソースコード 拡げる
#include<bits/stdc++.h>
#define REP(i,a,b) for(int i=a;i<=b;++i)
typedef long long ll;
using namespace std;
void File(){
freopen("ARC99D.in","r",stdin);
freopen("ARC99D.out","w",stdout);
}
double cal(ll x){
ll y=10,len=1,sum=0,ret=x;
while(y<=x)y=(y<<1)+(y<<3),++len;
while(len--){
y/=10;
sum+=x/y;
x%=y;
}
return ret*1.0/sum;
}
bool judge(ll x){
ll a=1;
while(a<=x){
if(cal(x+a)<cal(x))return false;
a=(a<<1)+(a<<3);
}
return true;
}
ll k,now;
int main(){
cin>>k;
while(k--){
ll a=1;
while(true){
if(judge(now+a)){
now+=a;
break;
}
a=(a<<1)+(a<<3);
}
cout<<now<<endl;
}
return 0;
}
提出情報
| 提出日時 |
|
| 問題 |
C - Minimization |
| ユーザ |
mengbierr |
| 言語 |
C++14 (GCC 5.4.1) |
| 得点 |
0 |
| コード長 |
839 Byte |
| 結果 |
RE |
| 実行時間 |
137 ms |
| メモリ |
256 KiB |
コンパイルエラー
./Main.cpp: In function ‘void File()’:
./Main.cpp:9:35: warning: ignoring return value of ‘FILE* freopen(const char*, const char*, FILE*)’, declared with attribute warn_unused_result [-Wunused-result]
freopen("ARC99D.in","r",stdin);
^
./Main.cpp:10:37: warning: ignoring return value of ‘FILE* freopen(const char*, const char*, FILE*)’, declared with attribute warn_unused_result [-Wunused-result]
freopen("ARC99D.out","w",stdout);
^
ジャッジ結果
| セット名 |
Sample |
All |
| 得点 / 配点 |
0 / 0 |
0 / 300 |
| 結果 |
|
|
| セット名 |
テストケース |
| Sample |
sample1.txt, sample2.txt, sample3.txt |
| All |
sample1.txt, sample2.txt, sample3.txt, 1.txt, 10.txt, 2.txt, 3.txt, 4.txt, 5.txt, 6.txt, 7.txt, 8.txt, 9.txt, sample1.txt, sample2.txt, sample3.txt |
| ケース名 |
結果 |
実行時間 |
メモリ |
| 1.txt |
RE |
136 ms |
256 KiB |
| 10.txt |
RE |
136 ms |
256 KiB |
| 2.txt |
RE |
137 ms |
256 KiB |
| 3.txt |
RE |
136 ms |
256 KiB |
| 4.txt |
RE |
137 ms |
256 KiB |
| 5.txt |
RE |
136 ms |
256 KiB |
| 6.txt |
RE |
137 ms |
256 KiB |
| 7.txt |
RE |
137 ms |
256 KiB |
| 8.txt |
RE |
137 ms |
256 KiB |
| 9.txt |
WA |
34 ms |
256 KiB |
| sample1.txt |
WA |
1 ms |
256 KiB |
| sample2.txt |
WA |
1 ms |
256 KiB |
| sample3.txt |
WA |
1 ms |
256 KiB |