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 ...
随机推荐
- tomcat jvm 内存调优 适用于 JDK 6 & 7
参考:https://blog.csdn.net/m0_37327416/article/details/76185051 1.jvm内存管理机制: 1)堆(Heap)和非堆(Non-heap)内存 ...
- day07-多表查询
本节重点: 多表连接查询 符合条件连接查询 子查询 准备工作:准备两张表,部门表(department).员工表(employee) create table department( id int, ...
- centos7 操作记录
centos7 firewall 命令查看已经开放的端口firewall-cmd --list-ports查看开放的服务firewall-cmd --list-services开启端口firewall ...
- 重置mysql5.7密码
其实想要重置 5.7 的密码很简单,就一层窗户纸: 1.修改 /etc/my.cnf,在 [mysqld] 小节下添加一行:skip-grant-tables=1 这一行配置让 mysqld 启动时不 ...
- confusing c++ 重写 与 重定义 记录1
class parent { public: void f() { cout << "parent f()" << endl; } void f(int i ...
- Unicode UTF8 UTF16 urlencode base64
Unicode:是一个字符集,每个字符对应一个唯一的unicode编码,一般是16位. UTF8是针对Unicode的编码方式,因为如果每个字符都用unicode的编码存储的话会很浪费空间,比如说as ...
- Rafy源码解读 笔记(一) DbMigration
主要功能,提供数据库的升级回滚和变迁操作. 整个模块的都是通过DbMigrationContext这个类来体现的,回滚或升级由若干个子操作完成,每个子操作被封装成一个类MigrationOperati ...
- oracle vm突然黑屏了
装完mongodb-compass后,我重启了下虚拟机,发现突然进不到ubuntu系统了,一开起来就黑屏.网上查了下有的说是显卡问题的,有说是内核问题的,但我啥都没干突然间就黑屏了.折腾了一下午没搞定 ...
- [ SHELL编程 ] 自动删除操作系统用户
Linux中经常需要删除用户,通常手工操作执行userdel操作即可,如果删除失败出现错误提示按照提示错误进行操作即可.如果是脚本需要调用删除用户操作呢?利用如下实例中drop_user删除用户函数, ...
- react设置innerHTML
<!DOCTYPE html> <html> <head> <meta content="text/html; charset=utf-8" ...