题干:

Problem Statement

We ask you to select some number of positive integers, and calculate the sum of them.

It is allowed to select as many integers as you like, and as large integers as you wish. You have to follow these, however: each selected integer needs to be a multiple of A, and you need to select at least one integer.

Your objective is to make the sum congruent to C modulo B. Determine whether this is possible.

If the objective is achievable, print YES. Otherwise, print NO.

Constraints

  • 1≤A≤100
  • 1≤B≤100
  • 0≤C<B

Input

Input is given from Standard Input in the following format:

A B C

Output

Print YES or NO.

Sample Input 1

7 5 1

Sample Output 1

YES

For example, if you select 7 and 14, the sum 21 is congruent to 1 modulo 5.

Sample Input 2

2 2 1

Sample Output 2

NO

The sum of even numbers, no matter how many, is never odd.

Sample Input 3

1 100 97

Sample Output 3

YES

You can select 97, since you may select multiples of 1, that is, all integers.

Sample Input 4

40 98 58

Sample Output 4

YES

Sample Input 5

77 42 36

Sample Output 5

NO

解题报告:

AC代码1:(找规律)

AC代码2:(自己写)

#include<cstdio>
#include<queue>
#include<string>
#include<cstring>
#include<cmath>
#include<map>
#include<iostream>
#include<algorithm>
#define ll long long
const ll mod = 1e9+7;
using namespace std;
int a,b,c;
int main()
{while(~scanf("%d%d%d",&a,&b,&c)) {int flag = 0;for(int k = 1; k<=10000005; k++) {if((b*k+c) % a == 0) {printf("YES\n");flag = 1;break;}}if(!flag) printf("NO\n");}return 0 ;
}

【AtCoder - 2554】Choose Integers (找规律,或枚举)相关推荐

  1. Yet Another Meme Problem(打表找规律)

    Try guessing the statement from this picture http://tiny.cc/ogyoiz. You are given two integers AA an ...

  2. [观察,找规律]算法题目训练

    [蓝桥杯2019初赛]旋转-找规律 蓝桥杯2017初赛-打印大X-找规律 [蓝桥杯2018初赛]分数-找规律 [蓝桥杯2019初赛]矩形切割-找规律 [蓝桥杯2018初赛]方格计数-巧妙枚举,找规,数 ...

  3. 【HDU - 5963】朋友(博弈,思维,必胜态必败态,找规律)

    题干: B君在围观一群男生和一群女生玩游戏,具体来说游戏是这样的: 给出一棵n个节点的树,这棵树的每条边有一个权值,这个权值只可能是0或1. 在一局游戏开始时,会确定一个节点作为根.接下来从女生开始, ...

  4. 【HDU - 5881】Tea(思维,找规律)

    题干: Tea is good. Tea is life. Tea is everything. The balance of tea is a journey of pursuing balance ...

  5. 【CodeForces - 1027B 】Numbers on the Chessboard (没有营养的找规律题,无聊题)

    题干: You are given a chessboard of size n×nn×n. It is filled with numbers from 11 to n2n2 in the foll ...

  6. 【HDU - 1564 】Play a game (博弈问题,找规律,奇偶博弈)

    题干: New Year is Coming!  ailyanlu is very happy today! and he is playing a chessboard game with 8600 ...

  7. 【CodeForces - 764A】Taymyr is calling you (找规律,水题)

    题干: Comrade Dujikov is busy choosing artists for Timofey's birthday and is recieving calls from Taym ...

  8. hdu 1165 坑爹找规律题

    http://acm.hdu.edu.cn/showproblem.php?pid=1165 不看题解,使劲找规律,应该是可以找到的,就是费时间! Problem Description As is ...

  9. D. Pythagorean Triples(1487D)(打表找规律 + 二分)

    D. Pythagorean Triples(1487D)(打表找规律 + 二分) 题目来源:D. Pythagorean Triples 题意: 给定一个 n,求满足以下条件的数对 (a, b, c ...

最新文章

  1. pandas 增加列
  2. mybatis 注解 动态sql_Mybatis 的动态 SQL 语句
  3. css禁用鼠标点击事件
  4. java增加缓存,java – 如何增加Integer对象的缓存大小
  5. 区间覆盖全部类型及部分精选习题汇总详解(贪心策略)
  6. 无限场景开放式仿真器 PGDrive:Improving the Generalization of End-to-End Driving through Procedural Generation
  7. 爆款专栏《Python 黑科技》目录导航丨进度:12/50
  8. bzoj1189 [HNOI2007]紧急疏散EVACUATE spfa+网络流+二分
  9. 如何改变Static Text控件中文字的字体,字体大小及颜色。
  10. 计算机硬件格式,排版格式要求_计算机硬件及应用_IT/计算机_资料
  11. Android学习进阶路线导航线路(Android源码分享)
  12. 关于SVN状态图标不显示的解决办法(史上最全)
  13. 业务重点-实现一个简单的手机号码验证
  14. edgewin10无法安装_如何解决Win10 Edge浏览器无法下载文件?
  15. D-Tale,实现Pandas GUI高效数据分析
  16. 一文掌握差模信号、共模信号、共模抑制比的概念
  17. Linux I2C从设备树信息查看与添加方法
  18. 本科生毕业设计选题——计算机类
  19. vue3使用less,scoped后发现:deep不生效
  20. Python多线程多进程应用场景

热门文章

  1. [Leetcode][第491题][JAVA][递增子序列][回溯][RK算法]
  2. [Leetcode][程序员面试金典][面试题08.03][JAVA][魔术索引][递归][优化]
  3. Java学习笔记10-1——MyBatis
  4. java ajax 获取headers_Ajax获取Response头信息
  5. md5与des算法有何不同_到底AI芯片和传统芯片有何区别?
  6. 剪切文件_lammps模拟带缺陷镍板剪切变形(in文件及注释)
  7. python多线程logger_python多线程logger_Dblogger:一个Python语言实现支持多进程和多线程日志打印高效Python日志库......
  8. 2020数学建模国赛C题思路
  9. 自动化测试工具selenium python_Selenium自动化测试工具使用方法汇总
  10. 怎样在PropertySheet中添加按钮