Submission #17626860
Source Code Expand
Copy
#include <bits/stdc++.h>
using namespace std;
typedef signed long long ll;
#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define FORR2(x,y,arr) for(auto& [x,y]:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------
ll N;
map<ll,int> M;
void solve() {
int i,j,k,l,r,x,y; string s;
cin>>N;
ll v=1;
for(i=1;;i++) {
v*=5;
M[v]=i;
if(v>1000000000000000000LL) break;
}
v=1;
for(i=1;;i++) {
v*=3;
if(M.count(N-v)) {
cout<<i<<" "<<M[N-v]<<endl;
return;
}
if(v>1000000000000000000LL) break;
}
cout<<-1<<endl;
}
int main(int argc,char** argv){
string s;int i;
if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
cout.tie(0); solve(); return 0;
}
Submission Info
Submission Time |
|
Task |
A - 106 |
User |
kmjp |
Language |
C++ (GCC 9.2.1) |
Score |
300 |
Code Size |
1094 Byte |
Status |
AC |
Exec Time |
8 ms |
Memory |
3620 KB |
Compile Error
./Main.cpp: In function ‘void solve()’:
./Main.cpp:21:8: warning: unused variable ‘j’ [-Wunused-variable]
21 | int i,j,k,l,r,x,y; string s;
| ^
./Main.cpp:21:10: warning: unused variable ‘k’ [-Wunused-variable]
21 | int i,j,k,l,r,x,y; string s;
| ^
./Main.cpp:21:12: warning: unused variable ‘l’ [-Wunused-variable]
21 | int i,j,k,l,r,x,y; string s;
| ^
./Main.cpp:21:14: warning: unused variable ‘r’ [-Wunused-variable]
21 | int i,j,k,l,r,x,y; string s;
| ^
./Main.cpp:21:16: warning: unused variable ‘x’ [-Wunused-variable]
21 | int i,j,k,l,r,x,y; string s;
| ^
./Main.cpp:21:18: warning: unused variable ‘y’ [-Wunused-variable]
21 | int i,j,k,l,r,x,y; string s;
| ^
./Main.cpp: In function ‘int main(int, char**)’:
./Main.cpp:7:28: warning: comparison of integer expressions of different signedness: ‘int’ and ‘std::__cxx11::basic_string<char>::size_type’ {aka ‘long unsigned int’} [-Wsign-compare]
7 | #define FOR(x,to) for(x=0;x<(to);x++)
| ^
./Main.cpp:49:38: note: in expansion of macro ‘FOR’
49 | FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
| ^~~
Judge Result
Set Name |
Sample |
All |
Score / Max Score |
0 / 0 |
300 / 300 |
Status |
|
|
Set Name |
Test Cases |
Sample |
00_sample_00, 00_sample_01, 00_sample_02 |
All |
00_sample_00, 00_sample_01, 00_sample_02, 01_test_00, 01_test_01, 01_test_02, 01_test_03, 01_test_04, 01_test_05, 01_test_06, 01_test_07, 01_test_08, 01_test_09, 01_test_10, 01_test_11, 01_test_12, 01_test_13, 01_test_14, 01_test_15, 01_test_16, 01_test_17, 02_beet_killer |
Case Name |
Status |
Exec Time |
Memory |
00_sample_00 |
AC |
8 ms |
3612 KB |
00_sample_01 |
AC |
4 ms |
3600 KB |
00_sample_02 |
AC |
2 ms |
3452 KB |
01_test_00 |
AC |
3 ms |
3596 KB |
01_test_01 |
AC |
2 ms |
3560 KB |
01_test_02 |
AC |
2 ms |
3524 KB |
01_test_03 |
AC |
2 ms |
3536 KB |
01_test_04 |
AC |
2 ms |
3620 KB |
01_test_05 |
AC |
2 ms |
3600 KB |
01_test_06 |
AC |
2 ms |
3448 KB |
01_test_07 |
AC |
2 ms |
3448 KB |
01_test_08 |
AC |
4 ms |
3540 KB |
01_test_09 |
AC |
2 ms |
3440 KB |
01_test_10 |
AC |
2 ms |
3600 KB |
01_test_11 |
AC |
2 ms |
3560 KB |
01_test_12 |
AC |
2 ms |
3516 KB |
01_test_13 |
AC |
2 ms |
3600 KB |
01_test_14 |
AC |
2 ms |
3600 KB |
01_test_15 |
AC |
2 ms |
3560 KB |
01_test_16 |
AC |
2 ms |
3536 KB |
01_test_17 |
AC |
2 ms |
3576 KB |
02_beet_killer |
AC |
2 ms |
3524 KB |