A. Ebony and Ivory

题目连接:

http://www.codeforces.com/contest/633/problem/A

Description

Dante is engaged in a fight with "The Savior". Before he can fight it with his sword, he needs to break its shields. He has two guns, Ebony and Ivory, each of them is able to perform any non-negative number of shots.

For every bullet that hits the shield, Ebony deals a units of damage while Ivory deals b units of damage. In order to break the shield Dante has to deal exactly c units of damage. Find out if this is possible.

Input

The first line of the input contains three integers a, b, c (1 ≤ a, b ≤ 100, 1 ≤ c ≤ 10 000) — the number of units of damage dealt by Ebony gun and Ivory gun, and the total number of damage required to break the shield, respectively.

Output

Print "Yes" (without quotes) if Dante can deal exactly c damage to the shield and "No" (without quotes) otherwise.

Sample Input

4 6 15

Sample Output

No

Hint

题意

给你 a,b,c

问你能够使用若干个a和若干个b,恰好组成c

题解:

暴力枚举一个,然后O(1)算另外一个就好了

代码

#include<bits/stdc++.h>
using namespace std; int main()
{
long long a,b,c;
cin>>a>>b>>c;
for(int i=0;i<=100000;i++)
{
long long res = c - a*i;
if(res==0)return puts("Yes");
if(res<0)break;
long long p = res/b;
if(p*b==res)
return puts("Yes");
}
return puts("No");
}

Manthan, Codefest 16 A. Ebony and Ivory 水题的更多相关文章

  1. Manthan, Codefest 16 -A Ebony and Ivory

    time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standa ...

  2. Manthan, Codefest 16

    暴力 A - Ebony and Ivory import java.util.*; import java.io.*; public class Main { public static void ...

  3. Manthan, Codefest 16 D. Fibonacci-ish

    D. Fibonacci-ish time limit per test 3 seconds memory limit per test 512 megabytes input standard in ...

  4. Manthan, Codefest 16(B--A Trivial Problem)

    B. A Trivial Problem time limit per test 2 seconds memory limit per test 256 megabytes input standar ...

  5. Manthan, Codefest 16 -C. Spy Syndrome 2

    time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standa ...

  6. CF Manthan, Codefest 16 G. Yash And Trees 线段树+bitset

    题目链接:http://codeforces.com/problemset/problem/633/G 大意是一棵树两种操作,第一种是某一节点子树所有值+v,第二种问子树中节点模m出现了多少种m以内的 ...

  7. CF #Manthan, Codefest 16 C. Spy Syndrome 2 Trie

    题目链接:http://codeforces.com/problemset/problem/633/C 大意就是给个字典和一个字符串,求一个用字典中的单词恰好构成字符串的匹配. 比赛的时候是用AC自动 ...

  8. CF Manthan, Codefest 16 B. A Trivial Problem

    数学技巧真有趣,看出规律就很简单了 wa 题意:给出数k  输出所有阶乘尾数有k个0的数 这题来来回回看了两三遍, 想的方法总觉得会T 后来想想  阶乘 emmm  1*2*3*4*5*6*7*8*9 ...

  9. Manthan, Codefest 16 H. Fibonacci-ish II 大力出奇迹 莫队 线段树 矩阵

    H. Fibonacci-ish II 题目连接: http://codeforces.com/contest/633/problem/H Description Yash is finally ti ...

随机推荐

  1. 【Python学习笔记】Coursera课程《Using Python to Access Web Data》 密歇根大学 Charles Severance——Week6 JSON and the REST Architecture课堂笔记

    Coursera课程<Using Python to Access Web Data> 密歇根大学 Week6 JSON and the REST Architecture 13.5 Ja ...

  2. mongodb-linux-x86_64

    卷 DataDisk 的文件夹 PATH 列表卷序列号为 4A8E-D95CD:.│  1.txt│  GNU-AGPL-3.0│  MPL-2│  README│  THIRD-PARTY-NOTI ...

  3. telnet如何保存输出内容到本地

    telnet如何保存输出内容到本地 http://bbs.csdn.net/topics/391023327 一种将程序的标准输出重定向到telnet终端的方法 http://blog.chinaun ...

  4. C#比较两个list集合,两集合同时存在或A集合存在B集合中无

    using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.T ...

  5. centos7 安装 NVIDIA Docker

    安装环境: 1.centos7.3 2.NVIDIA Corporation GP106 [GeForce GTX 1060 6GB] 安装nvidia-docker a.安装docker 可参考ce ...

  6. CDN网站加速技术

    什么是CDN? CDN(Content Delivery Network 内容分发网络)技术通过在各个地区部署缓存节点加速用户对静态资源的获取速度,提升用户体验,降低运营成本.CDN公司有网宿(Chi ...

  7. Keepalived高可用配置

    Keepalived简介 Keepalived基于VRRP协议在服务器之间建立了主备关系,通常称之为高可用对.VRRP中文叫虚拟路由冗余协议,目的是解决静态路由的单点故障问题.高可用对之间通过IP多播 ...

  8. JS监控手机或APP返回事件

    做微信项目的时候,发现在Ios微信浏览器左上角有个返回按钮,但是点击返回时不稳定,跳到不该跳的页面.网上搜了一个捕获返回事件的JS代码,记录下来,便于以后查看. <span style=&quo ...

  9. linux命令(2):grep命令

    实例一: a.log文件内容如下: 从 a.log 文件中提取包含“WARNING”或”FATAL”,同时不包含“IGNOR”的行 grep -E 'WARNING|FATAL' a.log | gr ...

  10. POJ-2594

    Treasure Exploration Time Limit: 6000MS   Memory Limit: 65536K Total Submissions: 7035   Accepted: 2 ...