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 ...
随机推荐
- 16.linux常用查看命令
cat :查看整个文件tail -200f abc.txt :查看abc.txt的最后200行
- 浅谈如何避免内存泄漏(out of memory)
1.在涉及使用Context时,对于生命周期比Activity长的对象应该使用Application的Context.凡是使用Context优先考虑Application的Context,当然它并不是 ...
- Linux服务器mysql,nginx等自动停止的排查,以及解决方法
最近发现自己使用的某台云服务武器只要稍微流量大一点,就会出现莫名的的数据库连接错误的情况 ,然后连上服务器查看,发现mysql进程被结束了,经常出现这种情况,这还怎么得了,然后第一时间查看mysql日 ...
- 采用EntityFramework.Extended 对EF进行扩展
今天我们来讲讲EntityFramework.Extended 首先科普一下这个EntityFramework.Extended是什么,如下: 这是一个对Entity Framework进行扩展的类库 ...
- kafka无法消费数据
遇到一个问题,使用Python kafka客户端和kafka命令行都无法消费数据,但是在kafka命令行后面添加--partition 0后就可以消费数据. bin/kafka-console-con ...
- UnicodeDecodeError: 'ascii' codec can't decode byte 0x9c in position 1: ordinal not in range(128)
待研究: compressed_data = zlib.compress(json.dumps(data), 9) file_data = MySQLdb.escape_string(compress ...
- CSS COLOR
CSS COLOR Color Review We've completed our extensive tour of the colors in CSS! Let's review the key ...
- Java相关文章
servlet/filter/listener/interceptor区别与联系 web.xml配置详解 在Eclipse中使用JUnit4进行单元测试(初级篇) 单点登录原理与简单实现 spring ...
- Visual Studio配置C/C++-PostgreSQL(9.6.3)开发环境(ZT)
https://www.2cto.com/database/201707/658910.html 开发环境 Visual Studio 2017[15.2(26430.16)] PostgreSQL ...
- [Redis]Redis的快速配置使用(图)
--------------------------------------------------------------------------------------------------- ...