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

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.

Examples

input

4 6 15

output

No

input

3 2 7

output

Yes

input

6 11 6

output

Yes

Note

In the second sample, Dante can fire 1 bullet from Ebony and 2 from Ivory to deal exactly 1·3 + 2·2 = 7 damage. In the third sample, Dante can fire 1 bullet from ebony and no bullets from ivory to do 1·6 + 0·11 = 6 damage.

题意:判断c 能不能由A,B组成

暴力枚举即可

#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <string>
#include <stack>
#include <queue>
#include <vector>
#include <set>
#include <list>
#include <map>
#include <iostream>
#include <algorithm> using namespace std; typedef long long LL; const int INF = 0x3f3f3f3f; const double eps = 1e-6; const double PI = acos(-1.0); int a,b,c; int main()
{
cin>>a>>b>>c; bool flag=false;
for(int i=0;a*i<=c;i++)
{
if((c-a*i)%b==0)
{
flag= true; break;
}
} if(flag)
{
cout<<"Yes"<<endl;
}
else {
cout<<"No"<<endl;
}
return 0;
}

Manthan, Codefest 16 -A Ebony and Ivory的更多相关文章

  1. Manthan, Codefest 16 A. Ebony and Ivory 水题

    A. Ebony and Ivory 题目连接: http://www.codeforces.com/contest/633/problem/A Description Dante is engage ...

  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. VC中对文件的读写

    http://www.cnblogs.com/LJWJL/archive/2012/10/06/2712466.html 注意: 1.由于C是缓冲写 所以要在关闭或刷新后才能看到文件内容 2.电脑处理 ...

  2. 极光推送Jpush(v3)服务端PHP版本的api脚本类

    原文地址:http://www.dodobook.net/php/780 关于极光推送的上一篇文章已经说明了,此处就不多说了.使用v3版本的原因是v2使用到2014年年底就停止了.点击查看上一篇的地址 ...

  3. mysql 联合查询后update

    SELECT a.user_name,a.avatar,a.nicheng,a.user_rank,b.rank_name,b.rank_img FROM ecs_users a , ecs_user ...

  4. CodeIgniter 下引入ORM Doctrine

    做了两年的CI开发,一直使用activeRecord来操作数据库.简单,轻巧加方便.最近一个项目交给手下去做,也是采用从数据库设计入手的开发流程,现在已经上线运行.经历了理清需求,设计数据库,在CI中 ...

  5. LeetCode Design Hit Counter

    原题链接在这里:https://leetcode.com/problems/design-hit-counter/. 题目: Design a hit counter which counts the ...

  6. linux下设置固定IP

    编辑网卡配置文件 vi /etc/sysconfig/network-script/ifcfg-eth0 进入编辑模式 按i键进行编辑修改 DEVICE=eth0 #物理设备名 IPADDR=192. ...

  7. PHP获取某个表与其他表的关联关系算法

    如图 电影movie有多个附表,如果通过movie表来找出多个与之关联的表. 本算法规则: 外键写法必须是X_id; A与B 1对多关系,中间表表名必须是A_B,且A_B,必须包含A_id,B_id外 ...

  8. 暑假CTF训练一

    暑假CTF训练一 围在栅栏中的爱 题目: 最近一直在好奇一个问题,QWE到底等不等于ABC? -.- .. --.- .-.. .-- - ..-. -.-. --.- --. -. ... --- ...

  9. http 中定义的八种请求的介绍

    在http1.1协议中,共定义了8种可以向服务器发起的请求(这些请求也叫做方法或动作),本文对这八种请求做出简要的介绍: 1.PUT:put的本义是推送 这个请求的含义就是推送某个资源到服务器,相当于 ...

  10. Java多线程学习(二)

    一.定义产生返回值的任务 在上一篇文的介绍中,我们知道了定义任务通常的方法是定义一个实现Runnable接口的类,这个类被我们成为任务.然而也很容易注意到,任务的最重要的一个方法就是run( )方法, ...