codeforces 633A A. Ebony and Ivory(暴力)
2 seconds
256 megabytes
standard input
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.
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.
Print "Yes" (without quotes) if Dante can deal exactly c damage to the shield and "No" (without quotes) otherwise.
4 6 15
No
3 2 7
Yes
6 11 6
Yes
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.
题意很简单,直接暴力;
AC代码:
#include <bits/stdc++.h>
using namespace std;
int main()
{
int a,b,c;
scanf("%d%d%d",&a,&b,&c);
for(int i=0;i< c/a+2;i++)
{
for(int j=0;j<c/b+2;j++)
{
if(i*a+j*b==c)
{
cout<<"YES";
return 0;
}
}
}
cout<<"NO";
return 0;
}
codeforces 633A A. Ebony and Ivory(暴力)的更多相关文章
- codeforces Ebony and Ivory(水题)
A. Ebony and Ivory time limit per test 2 seconds memory limit per test 256 megabytes input standard ...
- Manthan, Codefest 16 A. Ebony and Ivory 水题
A. Ebony and Ivory 题目连接: http://www.codeforces.com/contest/633/problem/A Description Dante is engage ...
- Manthan, Codefest 16 -A Ebony and Ivory
time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standa ...
- Codeforces Gym 100513M M. Variable Shadowing 暴力
M. Variable Shadowing Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/gym/100513/ ...
- Codeforces Gym 100513G G. FacePalm Accounting 暴力
G. FacePalm Accounting Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/gym/100513 ...
- Codeforces Gym 100002 C "Cricket Field" 暴力
"Cricket Field" Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/gym/1000 ...
- Codeforces 839A Arya and Bran【暴力】
A. Arya and Bran time limit per test:1 second memory limit per test:256 megabytes input:standard inp ...
- Codeforces 827E Rusty String - 快速傅里叶变换 - 暴力
Grigory loves strings. Recently he found a metal strip on a loft. The strip had length n and consist ...
- Codeforces Beta Round #3 B. Lorry 暴力 二分
B. Lorry 题目连接: http://www.codeforces.com/contest/3/problem/B Description A group of tourists is goin ...
随机推荐
- COM对象模型
COM对象内存布局,多继承是虚继承吗? 接口之间怎么切换? 1) 是普通的多继承,不是虚继承.因为父类接口只是含有纯虚函数,不含任何数据成员,所以问题不大. 2) QueryInterface可以用来 ...
- ASP.NET动态网站制作(21)-- C#(4)
前言:这节课是C#讲解的第四节课,主要围绕面向对象的三大特性展开.上节课已经把封装讲完了,这节课讲继承和多态. 内容: 1.继承:写程序的时候有些信息是公共的,可以将这些公共的信息写在父类里,增强代码 ...
- SpringMVC基于代码的配置方式(零配置,无web.xml)
基于配置文件的web项目维护起来可能会更方便,可是有时候我们会有一些特殊的需求,比方防止客户胡乱更改配置,这时候我们须要给配置隐藏到代码中. 1.创建一个动态web项目(无需web.xml) 2.右键 ...
- LCD驱动程序(二)
上节我们主要是对fb_info结构体的配置,对fb_info结构体的配置主要分为一下步骤: static int lcd_init(void){ /* 1. 分配一个fb_info */ s3c_lc ...
- 圆环自带动画进度条ColorfulRingProgressView
这是项目中遇到了,我也是借鉴大神的, 下载地址:https://github.com/oooohuhu/ColorfulRingProgressView 我把它导入了github中了,里面有详细的使用 ...
- Razor里写函数
asp.net mvc的视图里使用Razor来书写服务器代码,人尽皆知.可以常常见到里面写上for循环语句,输出一大堆东东,牛逼得很. 可是,如果循环语句还不能满足我们的要求,需要定义一个函数来调用, ...
- MySQL 数据库事物隔离级别的设置
select @@tx_isolation; //查看隔离级别 set session transaction isolation level read uncommitted; //设置读未提交级别 ...
- every row of W is a classifier for one of the classes
every row of W is a classifier for one of the classes As we saw above, every row of W is a classifie ...
- SM30 表格维护生成器
1)SE11创建自建表,结构如下: 2) 创建表维护 3) 针对上面创建的函数组ZMM_MAT_DESC,做以下增强处理 添加的Module 代码如下: module mod_customize in ...
- ADO.NET概述
xml这类文件它是.net变成环境中优先使用的数据访问借口. ADO.NET传输的数据都是XML格式的 ADO.NET是一组用于和数据源惊醒交互的面向对象类库 数据源:通常是各种数据库,但文本.exc ...