Cod sursa(job #3311153)
| Utilizator | Data | 19 septembrie 2025 22:18:43 | |
|---|---|---|---|
| Problema | A+B | Scor | 0 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva de probleme | Marime | 0.4 kb |
#include <iostream>
#include <cmath>
int func (int n){
int r=0;
while (n){
r+=n%10;
n/=10;
}
return r;
}
using namespace std;
int main (){
int n, r;
cin >> n;
while (r>=pow(10,n-1)-1){
r=pow(10,n-1)-1;
int j=func(r);
if (j%3==0){
cout<<j;
break;
}
r++;
}
return 0;
}