e-olymp Problem4196 Chocolate bars
吐槽一下,这个OJ的题目真的是阅读理解题。代码非常短,就是题目难理解。心累。
传送门:点我
Chocolate bars
It is hard to overestimate the role of chocolate bars in traditional programming competitions. Firstly, the nutritional content of chocolate significantly increases the number of brilliant ideas among the participants of the Olympiad. Geometric shape of the tiles is usually a rectangle of size a × b of square pieces 1 × 1, which in turn recalls the model of many problems.
Given the size of one chocolate bar a × b and the number of Olympiad participants n. The jury members want to determine the number of enough chocolate bars, so that breaking the bars into single pieces, it will be possible to divide them equally among all n participants. That is, each participants can receive equal number of square tiles 1 × 1.
Input
Positive integers a, b, n. All numbers do not exceed 100.
Output
Print the enough number of chocolate bars.
3 5 6
2 题意:输入的是a,b,n,巧克力大小为a*b,可以分成1*1的,要求给n个人分,每个人都要一样多。
样例是,3*5*2,这样就能分成30个1*1,能给6个人均分。而15个1*1则不行。
思路:非常非常没意思的题,直接暴力枚举(a*b*i)%n 是否等于0就行,i每次加一。还是读题不太好玩。
代码:
#include <cstdio>
#include <iostream>
using namespace std;
int main()
{
int a,b,n,k = ;
cin>>a>>b>>n;
int ans = a*b,sum = a*b;
while(ans%n){
k++;
ans+=sum;
}
printf("%d\n",k);
}
e-olymp Problem4196 Chocolate bars的更多相关文章
- Codeforces Beta Round #6 (Div. 2 Only) C. Alice, Bob and Chocolate 水题
C. Alice, Bob and Chocolate 题目连接: http://codeforces.com/contest/6/problem/C Description Alice and Bo ...
- 【cf490】D. Chocolate(素数定理)
http://codeforces.com/contest/490/problem/D 好神的一题,不会做.. 其实就是将所有的质因子找出来,满足: 最终的所有质因子的乘积相等 但是我们只能操作质因子 ...
- C - Alice, Bob and Chocolate(贪心)
Problem description Alice and Bob like games. And now they are ready to start a new game. They have ...
- codeforces 490 D Chocolate
题意:给出a1*b1和a2*b2两块巧克力,每次可以将这四个数中的随意一个数乘以1/2或者2/3,前提是要可以被2或者3整除,要求最小的次数让a1*b1=a2*b2,并求出这四个数最后的大小. 做法: ...
- Codeforces 490D Chocolate
D. Chocolate time limit per test 1 second memory limit per test 256 megabytes input standard input o ...
- TEXT 3 Food firms and fat-fighters
TEXT 3 Food firms and fat-fighters 食品公司与减肥斗士 Feb 9th 2006 From The Economist Global Agenda Five lead ...
- 【Datastage】函数大全
一. 类型转换函数 类型转换函数用于更改参数的类型. 以下函数位于表达式编辑器的"类型转换"类别中.方括号表示参数是可选的.缺省日期格式为 %yyyy-%mm-%dd. 以下示例按 ...
- SGU - 296 - Sasha vs. Kate
上题目: 296. Sasha vs. Kate Time limit per test: 1 second(s)Memory limit: 65536 kilobytes input: standa ...
- CF 1132A,1132B,1132C,1132D,1132E,1132F(Round 61 A,B,C,D,E,F)题解
A.Regular bracket sequence A string is called bracket sequence if it does not contain any characters ...
随机推荐
- 01.hadoop集群环境搭建
hadoop集群搭建的步骤 1.安装jdk2修改ip地址3.关闭防火墙4.修改hostname5.设置ssh自动登陆6.安装hadoop-------------------------------- ...
- chrome也可以整张网页截图,保存完整网页为图片
转自:http://www.webkaka.com/blog/archives/chrome-save-a-webpage.html 关于浏览器截图,一直以为Chrome无能为力,最近发现,原来Chr ...
- WPF线性渐变画刷应用之——炫彩线条
效果图: Xaml代码: <Rectangle Width="800" Height="10"> <Rectangle.Fill> &l ...
- UI5-学习篇-15-云连接SAP Cloud Connector
请关注地址:http://blog.itpub.net/29829936/viewspace-2128829/ 1.SCC下载及安装 https://tools.hana.ondemand.com/# ...
- guava collection/cache初探
写了上面一篇,看了点eventbus相关的guava代码后,发现里面用到了很多其他guava包里的方法,所以顺着看一下,比如之前用到的map都是guava自己的 Multimap:可以包含有几个重复K ...
- sublime text3:sublime text3本地服务器方式运行文件
网址:https://blog.csdn.net/md1688/article/details/70562381 1.Ctrl + Shift +P,启动Sublime Text的命令行(如果没有需要 ...
- Indy 10.5.8 for Delphi and Lazarus 修改版(2011)
Indy 10.5.8 for Delphi and Lazarus 修改版(2011) Internet Direct(Indy)是一组开放源代码的Internet组件,涵盖了几乎所有流行的I ...
- openvpn 批量生成用户脚本
#/bin/bash for user in "$@" do echo "新增用户:$user" if [ -d "/etc/openvpn/clie ...
- linq partion by 用法
var PartinoByList = list.OrderBy(x => x.DateType).GroupBy(x => new { x.ProductCatagoryId, x.Su ...
- Structs复习 命名空间
引入jar包 web.xml <?xml version="1.0" encoding="UTF-8"?> <web-app version= ...