-
-
Save theortsac/2f01891fc554782b302bccb8b90d29d0 to your computer and use it in GitHub Desktop.
Solução do problema Decimalmente Conectados.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <bits/stdc++.h> | |
using namespace std; | |
int main() { | |
int t; | |
cin >> t; | |
while(t--) { | |
int n; | |
cin >> n; | |
int z = n % 11; | |
if (z > 9) { | |
cout << -1 << "\n"; | |
} else { | |
int y = n/11; // podemos fazer isso pois o C++ arredonda o valor pra baixo automaticamente | |
int x = 10*y+z; | |
cout << x << " " << y << "\n"; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment