题意:

a*1234567+b*123456+c*1234=n
非负整数解得存在性。

题解:

看代码。
#include<iostream>
#include<cstdio>
using namespace std;
void fun(int n)
{
    int k=n/1234567+1;
    for(int i=0;i<k;i++)
        for(int j=0;;j++){
            int c=n-i*1234567-j*123456;
            if(c<0) break;
            if(c%1234==0){
                printf("YES\n");
                return ;
            }
        }
    printf("NO\n");
}
int main ()
{
    int n;
    while(~scanf("%d",&n)){
        fun(n);
    }
    return 0;
}

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-07-20
  • 2021-08-22
  • 2021-09-04
  • 2022-12-23
  • 2021-06-08
  • 2021-11-11
猜你喜欢
  • 2021-08-20
  • 2021-08-14
  • 2022-12-23
  • 2021-07-10
  • 2022-12-23
  • 2021-08-12
相关资源
相似解决方案