Skip to content

Instantly share code, notes, and snippets.

@theortsac
Created July 1, 2023 21:34
Show Gist options
  • Save theortsac/2f01891fc554782b302bccb8b90d29d0 to your computer and use it in GitHub Desktop.
Save theortsac/2f01891fc554782b302bccb8b90d29d0 to your computer and use it in GitHub Desktop.
Solução do problema Decimalmente Conectados.
#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