Submission #60166777
Source Code Expand
#include<bits/stdc++.h> #include"atcoder/all" using namespace std; using namespace atcoder; #define rep(i,n) for(int i=0;i<(n);i++) #define all(a) a.begin(),a.end() typedef long long ll; typedef vector<ll> vi; typedef pair<ll,ll> P; const ll mod=998244353; const ll inf=1ll<<61; typedef modint998244353 mi; string solve(string s){ ll dec=0; rep(i,s.size()){ dec=dec*8+s[i]-'0'; } string non; while(dec){ non.push_back('0'+dec%9); dec/=9; } reverse(all(non)); rep(i,non.size())if(non[i]=='8')non[i]='5'; return non; } int main(){ string s; int k; cin>>s>>k; if(s=="0"){ cout<<s<<endl; return 0; } rep(i,k)s=solve(s); cout<<s<<endl; }
Submission Info
Submission Time | |
---|---|
Task | 067 - Base 8 to 9(★2) |
User | Rho17 |
Language | C++ 20 (gcc 12.2) |
Score | 2 |
Code Size | 704 Byte |
Status | AC |
Exec Time | 2 ms |
Memory | 3716 KiB |
Compile Error
Main.cpp: In function ‘std::string solve(std::string)’: Main.cpp:5:31: warning: comparison of integer expressions of different signedness: ‘int’ and ‘std::__cxx11::basic_string<char>::size_type’ {aka ‘long unsigned int’} [-Wsign-compare] 5 | #define rep(i,n) for(int i=0;i<(n);i++) | ^ Main.cpp:16:9: note: in expansion of macro ‘rep’ 16 | rep(i,s.size()){ | ^~~ Main.cpp:5:31: warning: comparison of integer expressions of different signedness: ‘int’ and ‘std::__cxx11::basic_string<char>::size_type’ {aka ‘long unsigned int’} [-Wsign-compare] 5 | #define rep(i,n) for(int i=0;i<(n);i++) | ^ Main.cpp:26:9: note: in expansion of macro ‘rep’ 26 | rep(i,non.size())if(non[i]=='8')non[i]='5'; | ^~~
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 2 / 2 | ||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | sample_01.txt, sample_02.txt, sample_03.txt |
All | hand_01.txt, hand_02.txt, hand_03.txt, hand_04.txt, hand_05.txt, random_01.txt, random_02.txt, random_03.txt, random_04.txt, random_05.txt, random_06.txt, random_07.txt, random_08.txt, random_09.txt, random_10.txt, random_11.txt, random_12.txt, random_13.txt, random_14.txt, random_15.txt, random_16.txt, random_17.txt, random_18.txt, random_19.txt, random_20.txt, sample_01.txt, sample_02.txt, sample_03.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
hand_01.txt | AC | 2 ms | 3580 KiB |
hand_02.txt | AC | 1 ms | 3432 KiB |
hand_03.txt | AC | 1 ms | 3604 KiB |
hand_04.txt | AC | 1 ms | 3600 KiB |
hand_05.txt | AC | 1 ms | 3676 KiB |
random_01.txt | AC | 1 ms | 3588 KiB |
random_02.txt | AC | 1 ms | 3580 KiB |
random_03.txt | AC | 1 ms | 3708 KiB |
random_04.txt | AC | 1 ms | 3520 KiB |
random_05.txt | AC | 1 ms | 3444 KiB |
random_06.txt | AC | 1 ms | 3708 KiB |
random_07.txt | AC | 1 ms | 3488 KiB |
random_08.txt | AC | 1 ms | 3532 KiB |
random_09.txt | AC | 1 ms | 3592 KiB |
random_10.txt | AC | 1 ms | 3592 KiB |
random_11.txt | AC | 1 ms | 3484 KiB |
random_12.txt | AC | 1 ms | 3708 KiB |
random_13.txt | AC | 1 ms | 3460 KiB |
random_14.txt | AC | 1 ms | 3536 KiB |
random_15.txt | AC | 1 ms | 3480 KiB |
random_16.txt | AC | 1 ms | 3664 KiB |
random_17.txt | AC | 1 ms | 3544 KiB |
random_18.txt | AC | 1 ms | 3716 KiB |
random_19.txt | AC | 1 ms | 3488 KiB |
random_20.txt | AC | 1 ms | 3460 KiB |
sample_01.txt | AC | 1 ms | 3540 KiB |
sample_02.txt | AC | 1 ms | 3512 KiB |
sample_03.txt | AC | 1 ms | 3488 KiB |