吐槽一下,这个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 abn. All numbers do not exceed 100.

Output

Print the enough number of chocolate bars.

Time limit 1 second
Memory limit 128 MiB
Input example #1
3 5 6
Output example #1
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的更多相关文章

  1. 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 ...

  2. 【cf490】D. Chocolate(素数定理)

    http://codeforces.com/contest/490/problem/D 好神的一题,不会做.. 其实就是将所有的质因子找出来,满足: 最终的所有质因子的乘积相等 但是我们只能操作质因子 ...

  3. C - Alice, Bob and Chocolate(贪心)

    Problem description Alice and Bob like games. And now they are ready to start a new game. They have ...

  4. codeforces 490 D Chocolate

    题意:给出a1*b1和a2*b2两块巧克力,每次可以将这四个数中的随意一个数乘以1/2或者2/3,前提是要可以被2或者3整除,要求最小的次数让a1*b1=a2*b2,并求出这四个数最后的大小. 做法: ...

  5. Codeforces 490D Chocolate

    D. Chocolate time limit per test 1 second memory limit per test 256 megabytes input standard input o ...

  6. TEXT 3 Food firms and fat-fighters

    TEXT 3 Food firms and fat-fighters 食品公司与减肥斗士 Feb 9th 2006 From The Economist Global Agenda Five lead ...

  7. 【Datastage】函数大全

    一. 类型转换函数 类型转换函数用于更改参数的类型. 以下函数位于表达式编辑器的"类型转换"类别中.方括号表示参数是可选的.缺省日期格式为 %yyyy-%mm-%dd. 以下示例按 ...

  8. SGU - 296 - Sasha vs. Kate

    上题目: 296. Sasha vs. Kate Time limit per test: 1 second(s)Memory limit: 65536 kilobytes input: standa ...

  9. 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 ...

随机推荐

  1. url查询参数解析

    url查询参数解析 1.获取url的各部分值 举例http://i.cnblogs.com/EditPosts.aspx?opt=1 1.window.location.href(设置或获取整个 UR ...

  2. JS 事件 Event

    注册事件 target.addEventListener(type, listener, options); 或者 target.addEventListener(type, listener, us ...

  3. OV7670配置和调试小结

    先上一下OV7670的框架图 OV7670常用寄存器设置说明 直接看OV7670 Implementation Guide (V1.0)等 资料我已经上传了 https://files.cnblogs ...

  4. golang web框架 beego

    尝试了下,在go环境ready的情况下,花了2分钟完成了beego安装.项目生成和启动,效率还是不错的 1.安装: go get github.com/astaxie/beego go get git ...

  5. [bcc32 Error] typeinfo.h(154): E2367 Can't inherit RTTI class from non-RTTI base 'exception'

    [bcc32 Error] typeinfo.h(154): E2367 Can't inherit RTTI class from non-RTTI base 'exception'  Full p ...

  6. DLL 调试(C# 调用 C++ 的 DLL)

    操作步骤: (1) C++ 的 DLL 项目中设置断点: (2) C# 工程右键[属性]->[调试]->[启动调试器]中选中[启动本机代码调试]. 注:要调试 DLL 必须有 DLL 的源 ...

  7. 【坑】tableView cell默认选中

    在tableView展示的过程时候,如果想一开始就有一些cell默认被选中,不能在cellForRowAtIndexPath中cell.selected=YES, 必须在willDisplayCell ...

  8. win10 任务栏锁定,win键没反应

    现象:之前用win10,换成win10专业版后,安装360优化系统,过了几天后突然发现任务栏好像被锁定一般,按windows键没有任何反应,任务栏打开的文件,图片等等右键也没有反应,讲道理应该有关闭选 ...

  9. English Conversation – Checking in at an airport

    English Conversation – Checking in at an airport Share Tweet Share Tagged With: Ben Franklin Exercis ...

  10. Ajax与select标签的组合运用

    ---------------------------------------------------------------------------------------------------- ...