Otoshidama

Problem Link

Solution by Mr.Olimpia100 pts

Code / Notes

#include <bits/stdc++.h>
using namespace std;

/*int dig(int N) {
    int ans = 1;
    while (N > 10) {
        N /= 10;
        ans++;
    }
    return ans;
}*/

int main() {
   int N, Y;
   cin >> N >> Y;
   for (int i=0; i<=N; i++){
    for(int j=0; j<=N; j++){
        if(10000*i+5000*j+1000*(N-i-j)== Y && (N-i-j)>=0){
            cout << i << " " << j << " " << (N-i-j);
          exit(0);
        }
    }
   }
    cout << -1 << " " << -1 << " " << -1;


   // divisores.back()
   // divisores[divisores.size()-1]
}

Last updated 3 weeks, 3 days ago


« Back to problem