CodeForces 681B Economy Game

好水,直接模拟爆

#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#define CPY(A, B) memcpy(A, B, sizeof(A))
typedef long long LL;
typedef unsigned long long uLL;
const int MOD = int (1e9) + 7;
const int INF = 0x3f3f3f3f;
const LL INFF = 0x3f3f3f3f3f3f3f3fLL;
const double EPS = 1e-9;
const double OO = 1e20;
const double PI = acos (-1.0);
const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, 1, 0, -1};
using namespace std;
const int fcc[3]= {1234567,123456,1234};
int main() {
    int n,k; cin>>n; bool f=false;
    for (int i=0; i<820; i++) {
        for (int j=0; j<8200; j++) {
            k=n-fcc[0]*i-fcc[1]*j;
            if (k<0) {break;}
            else if (k%fcc[2]==0) {f=true;}
        }
    }
    (f) ?cout<<"YES\n":cout<<"NO\n";
    return 0;
}

你可能感兴趣的:(CodeForces)