A. Ebony and Ivory
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 abc (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.

题意:给你a  b  c三个数,问是否存在x  y使得a*x+b*y=c

数据不大直接暴力求解

#include<stdio.h>
#include<string.h>
#include<string>
#include<math.h>
#include<algorithm>
#define LL long long
#define PI atan(1.0)*4
#define DD double
#define MAX 100100
#define mod 10007
#define dian 1.000000011
using namespace std;
int main()
{
int a,b,c,t,n,m,i,j;
while(scanf("%d%d%d",&a,&b,&c)!=EOF)
{
int flag=0;
for(i=0;i<=c/a;i++)
{
if((c-i*a)%b==0)
{
flag=1;
break;
}
}
if(flag) printf("Yes\n");
else printf("No\n");
}
return 0;
}

  

codeforces 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. Codeforces Gym 100531G Grave 水题

    Problem G. Grave 题目连接: http://codeforces.com/gym/100531/attachments Description Gerard develops a Ha ...

  3. codeforces 706A A. Beru-taxi(水题)

    题目链接: A. Beru-taxi 题意: 问那个taxi到他的时间最短,水题; AC代码: #include <iostream> #include <cstdio> #i ...

  4. codeforces 569B B. Inventory(水题)

    题目链接: B. Inventory time limit per test 1 second memory limit per test 256 megabytes input standard i ...

  5. Codeforces 489A SwapSort (水题)

    A. SwapSort time limit per test 1 second memory limit per test 256 megabytes input standard input ou ...

  6. codeforces 688A A. Opponents(水题)

    题目链接: A. Opponents time limit per test 1 second memory limit per test 256 megabytes input standard i ...

  7. CodeForces 534B Covered Path (水题)

    题意:给定两个速度,一个一初速度,一个末速度,然后给定 t 秒时间,还每秒速度最多变化多少,让你求最长距离. 析:其实这个题很水的,看一遍就知道怎么做了,很明显就是先从末速度开始算起,然后倒着推. 代 ...

  8. Codeforces Gym 100286I iSharp 水题

    Problem I. iSharpTime Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hust.edu.cn/vjudge/contest/ ...

  9. CodeForces 705A(训练水题)

    题目链接:http://codeforces.com/problemset/problem/705/A 从第三个输出中可看出规律, I hate that I love that I hate it ...

随机推荐

  1. How to Determine the Version of Oracle XML Publisher for Oracle E-Business Suite 11i and Release 12 (Doc ID 362496.1)

    Modified: 29-Mar-2014 Type: HOWTO In this DocumentGoal   Solution   1. Based upon an output file gen ...

  2. 1741. Communication Fiend(dp)

    刷个简单的DP缓缓心情 1A #include <iostream> #include<cstdio> #include<cstring> #include< ...

  3. java.lang.NoClassDefFoundError: javax/wsdl/OperationType

    You should find the javax.wsdl package inside wsdl4j.jar Check for the line starting with 'Found IBM ...

  4. Exception in thread "main" java.lang.NoClassDefFoundError: UDP_Receive (wrong na me: com/ray/net/UDP_Receive)

    一.事件经过 今晚学习java网络编程,在eclipse中写了两个个java文件,一个发送端UDP_Send2.java,一个接收端UDP_Receive.java.实现发送端键盘录入信息,通过UDP ...

  5. 【转】android:layout_gravity和android:gravity的区别

    1.首先来看看android:layout_gravity和android:gravity的使用区别. android:gravity: 这个是针对控件里的元素来说的,用来控制元素在该控件里的显示位置 ...

  6. Android开源项目SlidingMenu深切解析

    demo:http://download.csdn.net/detail/javadxz/6954819 SlidingMenu的是一种斗劲新的设置界面或设备界面结果,在主界面左滑或者右滑呈现设置界面 ...

  7. 翻译【ElasticSearch Server】第一章:开始使用ElasticSearch集群(2)

    安装和配置集群(Installing and Configuring your Cluster) 第一步是确保正确安装了 Java SE环境.ElasticSearch需要版本6或更高的版本,可以从下 ...

  8. Corn Fields(POJ 3254状压dp)

    题意: n*m网格1能放0不能放 放的格子不能相邻 求一共多少种可放的方案. 分析: dp[i][j]第i行可行状态j的的最大方案数,枚举当前行和前一行的所有状态转移就行了(不放牛也算一种情况) #i ...

  9. SSH超时断开(ClientAliveInterval和ClientAliveCountMax )的使用

    有 2个方法 1 配置服务器 打开 /etc/ssh/sshd_config 找到 ClientAliveInterval 参数,如果没有就自己加一行 数值是秒,比如你设置为300,就是5分钟. Cl ...

  10. 白盒测试之gmock入门篇

    一.gmock是什么 gmock是google公司推出的一款开源的白盒测试工具.gmock是个很强大的东西,测试一个模块的时候,可能涉及到和其他模块交互,可以将模块之间的接口mock起来,模拟交互过程 ...