You are viewing a single comment's thread. Return to all comments →
#include <bits/stdc++.h> using namespace std; int main(void) { int t; cin >> t; for (int i = 0; i < t; i++) { int n, z; cin >> n; z = n; if(z % 3 == 0) { cout << string(z, '5') << endl; } while(z % 3 != 0) { z -= 5; if(z < 0) { cout<< "-1" << endl; break; } else { if(z % 3 == 0) cout << string(z, '5') << string((n - z), '3') << endl; } } } return 0; }
Sherlock and The Beast
You are viewing a single comment's thread. Return to all comments →