You are viewing a single comment's thread. Return to all comments →
C++ solution-->
#include <cmath> #include <cstdio> #include <vector> #include <iostream> #include <algorithm> using namespace std; int main() { int t, n, flag = 0; cin >> t; for(int i = 0; i < t; i++){ cin >> n; int z = n; while(z % 3 != 0){ z -= 5; if(z < 0){ cout << "-1" << endl; flag++; break; } } if(flag == 1){ flag = 0; }else{ cout << string( z, '5') << string( n-z, '3') << endl; } } return 0; }
Seems like cookies are disabled on this browser, please enable them to open this website
Sherlock and The Beast
You are viewing a single comment's thread. Return to all comments →
C++ solution-->