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 ...
随机推荐
- win10 死机 无响应
win10 死机 无响应 用着用着无响应,结束任务出不来,ctrl+alt+delete 无效. 点 窗口的关闭关闭不了. 鼠标键盘无响应. 写的代码变成乱码,影响太严重了,损失惨重. 紧急启动 c ...
- 爬虫--Scrapy-持久化存储操作
总体概况 持久化存储操作: a. 磁盘文件 a) 基于终端指令 i. 保证parse方法返回一个可迭代类型的对象(存储解析到的页面内容) ii. 使用终端指令完成数据存储到制定磁盘文件中的操作 1. ...
- ABAP-邮件发送
*&---------------------------------------------------------------------* *& Report ZRICO_TES ...
- css-选择器性能
ID选择器 比如#header 类选择器 比如.promo 元素选择器 比如 div 兄弟选择器 比如 h2 + p 子选择器 比如 li > ul 后代选择器 比如 ul a 7. 通用选择器 ...
- DMA/Zero copy
DMA: 直接内存访问,是一种不经过CPU而直接从内存存取数据的数据交换模式.在DMA模式下,CPU只须向DMA控制器下达指令,让DMA控制器来处理数据的传送,数据传送完毕再把信息反馈给CPU,这样就 ...
- Python文件夹与文件的操作(转)
最近在写的程序频繁地与文件操作打交道,这块比较弱,还好在百度上找到一篇不错的文章,这是原文传送门,我对原文稍做了些改动. 有关文件夹与文件的查找,删除等功能 在 os 模块中实现.使用时需先导入这个模 ...
- Linux命令:zip
语法: zip [选项] zip文件 源文件s 选项 全称 含义 举例 -r recursive 递归压缩子目录里的文件(包括子目录里的子目录) zip -r target.z ...
- avalon2学习教程06样式操作
avalon2的ms-css的变革思路与ms-attr一样,将多个操作合并成到一个对象里面处理,因此没有ms-css-name="value",只有ms-css="Obj ...
- jQuery中的end()方法
定义和用法 end() 方法结束当前链条中的最近的筛选操作,并将匹配元素集还原为之前的状态. 以上是官方说法,比较难理解. 还是用一个例子来说明 <!DOCTYPE html> <h ...
- 14.连接池.md
目录 连接池定义 常用开源连接池: DBCP: C3P0 连接池定义 使用统一的规范:javax.sql.DataSource实现统一编程 常用开源连接池: DBCP:tomcat C3P0:hibe ...