633B - A Trivial Problem - CodeForces Solution


brute force constructive algorithms math number theory *1300

Please click on ads to support us..

C++ Code:

#include<bits/stdc++.h>
using namespace std;


int main() {
    int m;
    cin >> m;
    int c2 = 0, c5 = 0;
    int i = 2;
    while(1) {
        int t = i;
        while(t%2==0) {
            t /= 2;
            c2++;
        }
        t = i;
        while(t%5==0) {
            t /= 5;
            c5++;
        }
        //cout << c2 << " " << c5 << endl;
        if(c2>m and c5>m) {
            cout << 0;
            return 0;
        }
        if(min(c2,c5)==m) {
            cout << 5 << endl;
            for(int j = 0; j < 5; j++) {
                cout << i++ << " ";
            }
            return 0;
        }
        i++;
    }
}


Comments

Submit
0 Comments
More Questions

1705C - Mark and His Unfinished Essay
1401C - Mere Array
1613B - Absent Remainder
1536B - Prinzessin der Verurteilung
1699B - Almost Ternary Matrix
1545A - AquaMoon and Strange Sort
538B - Quasi Binary
424A - Squats
1703A - YES or YES
494A - Treasure
48B - Land Lot
835A - Key races
1622C - Set or Decrease
1682A - Palindromic Indices
903C - Boxes Packing
887A - Div 64
755B - PolandBall and Game
808B - Average Sleep Time
1515E - Phoenix and Computers
1552B - Running for Gold
994A - Fingerprints
1221C - Perfect Team
1709C - Recover an RBS
378A - Playing with Dice
248B - Chilly Willy
1709B - Also Try Minecraft
1418A - Buying Torches
131C - The World is a Theatre
1696A - NIT orz
1178D - Prime Graph