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. lvs源代码分析

    以linux-2.6.21为例. 数据结构介绍: ip_vs_conn 对于某个连接记录其N元组, (client, vserver, rserver) & (address, port) Q ...

  2. 带你玩转JavaWeb开发之六-mysql基本语法详解及实例(4)

    按照分类的名称统计每个分类商品所花的总钱数[排序查询] SQL中对查询的列进行排序,使用关键字order by.默认情况下是升序的排序(从小到大的排序顺序关键字 asc).使用降序排序需要使用关键字d ...

  3. 烤鸭的Source Insight学习笔记

    如果你觉得这网页排版不好看,可以去下载我上传的word版:<烤鸭的Source Insight学习笔记.doc> http://download.csdn.NET/detail/benka ...

  4. Preference Screen 首选项

     设置Preference Screen (res\xml\userpreferences.xml) <?xml version="1.0" encoding="u ...

  5. Python 2.7 - CentOS 7 - ImportError: No module named Tkinter

    It's simple. sudo yum -y install tkinter Just want to say, "I'm back".

  6. Spring Data JPA

    转自: http://www.cnblogs.com/WangJinYang/p/4257383.html Spring 框架对 JPA 的支持 Spring 框架对 JPA 提供的支持主要体现在如下 ...

  7. java机试要点

    Java机试准备 一般结构:   import java.util.Scanner; public class Main{ public static void main(String[] args) ...

  8. vue 实现分转元的 过滤器

    1.啥也不说了直接上代码吧  使用起来超方便 Vue.filter('amount', function (number) { // var number = +val.replace(/[^\d.] ...

  9. ASP.NET MVC 表单submit()

    HTML代码 <form id="frmLogin"> <div class="form-group has-feedback"> &l ...

  10. Python Set Literals

    现有3种方式创建set() >>> def f(): ... return set([1, 2, 3]) ... >>> def h(): ... return s ...