Manthan, Codefest 16 A. Ebony and Ivory 水题
A. Ebony and Ivory
题目连接:
http://www.codeforces.com/contest/633/problem/A
Description
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.
Sample Input
4 6 15
Sample Output
No
Hint
题意
给你 a,b,c
问你能够使用若干个a和若干个b,恰好组成c
题解:
暴力枚举一个,然后O(1)算另外一个就好了
代码
#include<bits/stdc++.h>
using namespace std;
int main()
{
long long a,b,c;
cin>>a>>b>>c;
for(int i=0;i<=100000;i++)
{
long long res = c - a*i;
if(res==0)return puts("Yes");
if(res<0)break;
long long p = res/b;
if(p*b==res)
return puts("Yes");
}
return puts("No");
}
Manthan, Codefest 16 A. Ebony and Ivory 水题的更多相关文章
- Manthan, Codefest 16 -A Ebony and Ivory
time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standa ...
- Manthan, Codefest 16
暴力 A - Ebony and Ivory import java.util.*; import java.io.*; public class Main { public static void ...
- Manthan, Codefest 16 D. Fibonacci-ish
D. Fibonacci-ish time limit per test 3 seconds memory limit per test 512 megabytes input standard in ...
- 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 ...
- Manthan, Codefest 16 -C. Spy Syndrome 2
time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standa ...
- CF Manthan, Codefest 16 G. Yash And Trees 线段树+bitset
题目链接:http://codeforces.com/problemset/problem/633/G 大意是一棵树两种操作,第一种是某一节点子树所有值+v,第二种问子树中节点模m出现了多少种m以内的 ...
- CF #Manthan, Codefest 16 C. Spy Syndrome 2 Trie
题目链接:http://codeforces.com/problemset/problem/633/C 大意就是给个字典和一个字符串,求一个用字典中的单词恰好构成字符串的匹配. 比赛的时候是用AC自动 ...
- CF Manthan, Codefest 16 B. A Trivial Problem
数学技巧真有趣,看出规律就很简单了 wa 题意:给出数k 输出所有阶乘尾数有k个0的数 这题来来回回看了两三遍, 想的方法总觉得会T 后来想想 阶乘 emmm 1*2*3*4*5*6*7*8*9 ...
- Manthan, Codefest 16 H. Fibonacci-ish II 大力出奇迹 莫队 线段树 矩阵
H. Fibonacci-ish II 题目连接: http://codeforces.com/contest/633/problem/H Description Yash is finally ti ...
随机推荐
- CreateProcess中的部分参数理解
函数原型,这里写Unicode版本 WINBASEAPIBOOLWINAPICreateProcessW( _In_opt_ LPCWSTR lpApplicationName, //可执行文件名字 ...
- 网络设备之pci_device_id
标准PCI设备都有一个配置寄存器,用来存储各种参数: /* pci设备配置寄存器 */ struct pci_device_id { /* 厂商id,设备id */ __u32 vendor, dev ...
- C函数前向声明省略参数
这样的不带参数的函数声明,在c中是合法的,表示任意参数:当然我们自己写代码最好不要这样写了,但是读老代码还是会遇到: #include <stdio.h> void fun(); int ...
- ogre3d环境配置 SDK安装配置及简单事例教程
ogre3d环境配置 SDK安装配置及简单事例教程 http://www.cr173.com/html/22594_1.html ogre3d环境配置 SDK安装配置及简单事例教程 http://ww ...
- signal, sigaction,信号集合操作
信号是与一定的进程相联系的,而建立其信号和进程的对应关系,这就是信号的安装登记. Linux主要有两个函数实现信号的安装登记:signal和sigaction.其中signal在系统调用的基础上实现, ...
- Winfrom窗体间传值
1.通过tag属性传输,tag属性是存储与空间密切相关的数据.比如登陆界面的数据传输给主界面. 子窗体 ...
- tomcat远程调试参数备忘
tomcat远程调试,启动时添加参数: -server -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,ser ...
- Elasticsearch( 插件开发)
elasticsearch5.2.2 插件开发(一) Scripting plugins:这个插件本质来说,就是会调用用户的脚本,所以可以执行任何的程序,举例的话,可以通过这个插件,支持javascr ...
- WP的SEO工具汇总
Baidu Sitemap Generator 百度站点地图生成工具 https://wordpress.org/plugins/baidu-sitemap-generator/ This pulg ...
- 关于在C#中对函数重载理解
函数重载是个什么概念,才接触的这个概念的时候我也是完全昏了,还在自己看看了书后就理解了.那什么是函数重载呢?我个人理解的是在同一个作用域下有多个同名的函数,但是他们的形参的类型是不同的,或者参数个数是 ...