CodeForces 633 A.Ebony and Ivory(水~)
来源:互联网 发布:学北京话软件 编辑:程序博客网 时间:2024/06/06 05:57
Description
给出三个正整数a,b,c,问是否存在非负整数x和y满足x*a+y*b=c
Input
三个整数a,b,c(1<=a,b<=100,1<=c<=1e4)
Output
如果存在满足条件的x和y则输出Yes,否则输出No
Sample Input
4 6 15
Sample Output
No
Solution
简单题,直接枚举x判断c-x*a是否可以整除b即可
Code
#include<cstdio>#include<iostream>#include<cstring>#include<algorithm>#include<cmath>#include<vector>#include<queue>#include<map>#include<set>#include<ctime>using namespace std;typedef long long ll;#define INF 0x3f3f3f3f#define maxn 1111int a,b,c;int main(){ while(~scanf("%d%d%d",&a,&b,&c)) { int gg=1; for(int i=0;i<=c/a;i++) if((c-i*a)%b==0) { gg=0; break; } printf("%s\n",gg?"NO":"YES"); } return 0;}
0 0
- CodeForces 633 A.Ebony and Ivory(水~)
- Codeforces 633A Ebony and Ivory 【水题】
- CodeForces 633A-Ebony and Ivory
- CodeForces 633A之Ebony and Ivory
- 633A.Ebony and Ivory
- A. Ebony and Ivory
- Manthan, Codefest 16 -A Ebony and Ivory
- CodeForces Manthan, Codefest 16 A Ebony and Ivory 扩展欧几里德(其实暴力直接搞就可以)
- 【Manthan, Codefest 16A】【水题 暴力】Ebony and Ivory ax+by=z
- CodeForces 623 A. Graph and String(水~)
- CodeForces 611 A. New Year and Days(水~)
- CodeForces 610 A. Pasha and Stick(水~)
- CodeForces 610A Pasha and Stick (水)
- CodeForces - 584A Olesya and Rodion (模拟)水
- CodeForces - 658A Bear and Reverse Radewoosh (模拟)水
- CodeForces - 552A Vanya and Table (水)
- CodeForces - 554A Kyoya and Photobooks (水)
- CodeForces - 557A Ilya and Diplomas (模拟)水
- APP全栈工程师修炼之路(三)
- 解决C# WinForm 中 VSHOST.EXE 程序不关闭的问题(转)
- Mathematica 技术领域3
- Huffman编解码
- jQuery 遍历函数 ,javascript中的each遍历
- CodeForces 633 A.Ebony and Ivory(水~)
- PES,TS,PS,RTP等流的打包格式解析之PES流
- Problem A: 字符串“水”题(二进制存储)
- 敏俊物联MJIOT-AMB-02 RTL8195M 高性能wifi模块
- linux less查看日志信息
- Unity3D动态读取外部MP3文件给AudioSource
- Eclipse Switch WorkSpace 历史记录
- 【C语言 数据结构】栈的极简实现
- AngularJS2 学习笔记(一)