首页 > 分享 > 【Manthan, Codefest 16A】【水题 暴力】Ebony and Ivory ax+by=z

【Manthan, Codefest 16A】【水题 暴力】Ebony and Ivory ax+by=z

最新推荐文章于 2021-05-22 17:54:22 发布

snowy_smile 于 2016-02-28 13:09:41 发布

版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。

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.

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.



#include<stdio.h>

#include<iostream>

#include<string.h>

#include<string>

#include<ctype.h>

#include<math.h>

#include<set>

#include<map>

#include<vector>

#include<queue>

#include<bitset>

#include<algorithm>

#include<time.h>

using namespace std;

void fre() { freopen("c://test//input.in", "r", stdin); freopen("c://test//output.out", "w", stdout); }

#define MS(x,y) memset(x,y,sizeof(x))

#define MC(x,y) memcpy(x,y,sizeof(x))

#define MP(x,y) make_pair(x,y)

#define ls o<<1

#define rs o<<1|1

typedef long long LL;

typedef unsigned long long UL;

typedef unsigned int UI;

template <class T1, class T2>inline void gmax(T1 &a, T2 b) { if (b>a)a = b; }

template <class T1, class T2>inline void gmin(T1 &a, T2 b) { if (b<a)a = b; }

const int N = 0, M = 0, Z = 1e9 + 7, ms63 = 0x3f3f3f3f;

int casenum, casei;

int n, x, y;

bool check()

{

for (int i = 0; i*x <= n; ++i)

{

if ((n - i*x) % y == 0)return 1;

}

return 0;

}

int main()

{

while(~scanf("%d%d%d",&x,&y,&n))

{

puts(check() ? "Yes" : "No");

}

return 0;

}

相关知识

函数 f(z) 与 g(z) 分别以 z=a 为本性奇点和 m 阶极点,则 z=
死亡链坠
宠物洗澡很简单,ivory coat沐浴露值得选择
已知x=10,y=20,z=30;以下语句执行后x,y,z的值是( )。 If
根据下列实验事实:①X+Y2+ === X2++Y ②Z+2H2O Z(OH)2
如果映射w=f(z)在区域D内是单叶且保角的,则称此映射w= f(z)在D内是(
设三个变量x=1,y=2,z=3,则表达式y+=z
设(X,Y)的概率密度为 ,求Z=X+Y的概率密度。
高数题求解,微分方程xy″=y′的通解为?
试判断以下函数的可导性与解析性。f(z)=2x3+3iy3

网址: 【Manthan, Codefest 16A】【水题 暴力】Ebony and Ivory ax+by=z https://m.mcbbbk.com/newsview489312.html

所属分类:萌宠日常
上一篇: 远离尘世的幻想乡
下一篇: 乐高玩具牧羊犬的职责