Submission #1116338

# Submission time Handle Problem Language Result Execution time Memory
1116338 2024-11-21T14:12:03 Z vjudge1 Hedgehog Daniyar and Algorithms (IZhO19_sortbooks) C++17
0 / 100
1 ms 336 KB
#include <bits/stdc++.h>
#define sz size()
#define int long long
#define speed ios_base::sync_with_stdio(0);
#define in insert
#define pb push_back
using namespace std;
signed main() {
    speed;
    int a;
    cin >> a;
    int h=1;
    string s="";
    for(int i=0;i<1000;i++){
        if(a%9==0){
            a/=9;
            s+="9";
        }
        else break;
    }
    for(int i=0;i<1000;i++){
        if(a%8==0){
            a/=8;
            s+="8";
        }
        else break;
    }
    for(int i=0;i<1000;i++){
        if(a%7==0){
            a/=7;
            s+="7";
        }
        else break;
    }
    for(int i=0;i<1000;i++){
        if(a%6==0){
            a/=6;
            s+="6";
        }
        else break;
    }
    for(int i=0;i<1000;i++){
        if(a%5==0){
            a/=5;
            s+="5";
        }
        else break;
    }
    for(int i=0;i<1000;i++){
        if(a%4==0){
            a/=4;
            s+="4";
        }
        else break;
    }
    for(int i=0;i<1000;i++){
        if(a%3==0){
            a/=3;
            s+="3";
        }
        else break;
    }
    for(int i=0;i<1000;i++){
        if(a%2==0){
            a/=2;
            s+="2";
        }
        else break;
    }

    if(a==1){
        reverse(s.begin(),s.end());
        cout << s;
    }
    else cout << -1;

    return 0;
}

Compilation message

sortbooks.cpp: In function 'int main()':
sortbooks.cpp:12:9: warning: unused variable 'h' [-Wunused-variable]
   12 |     int h=1;
      |         ^
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 336 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 336 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 336 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 336 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 336 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 336 KB Output isn't correct
2 Halted 0 ms 0 KB -