吐槽一下,这个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. 01.制作ico图标的工具

    制作ico图标的工具在线转换地址: http://lvwenhan.com/convertico/ http://lvwenhan.com/convertico/Converticon.swf

  2. leetcode984

    public class Solution { private string M1(int A, int B) { StringBuilder sb = new StringBuilder(); ; ...

  3. 使用STM32CubeMX生成待机开关功能

    使用的开发板为MINISTM32 通过长按数秒KEY_UP 按键开机,并且通过 DS1 的闪烁指示程序已经开始运行,再次长按该键,则进入待机模式, DS1 关闭,程序停止运行.利用STM32的stan ...

  4. vue父子组件嵌套的时候遇到 - Component template should contain exactly one root element. If you are using v-i

    转自:https://blog.csdn.net/yangyiboshigou/article/details/72084619

  5. MySQL主从同步机制及同步中的问题处理

    http://www.drupal001.com/2012/03/mysql-master-slave-troubles/ http://www.jb51.net/article/33052.htm

  6. UICollectionView setPrefetchingEnabled

    UICollectionView 开启是否开启预加载,如果开启,cell在没显示的时候就回去调用cellForIndex…方法,如果没开启,cell只有在显示的时候才会去调用cellForIndex… ...

  7. Oracle 学习总结 - 内存优化

    实例内存优化 开启自动内存管理 1. 设置memory_max_target alter system set memory_max_target=1G scope=spfile; /*init.or ...

  8. RunAsAdmin

    program AdminCMD; {$APPTYPE CONSOLE} uses  Windows,  ShellApi,  SysUtils; function RunAsAdmin(const ...

  9. LINUX系统一一常用命令

    前言 LINUX UNIX Centos RedHat Ubuntu SHELL shell脚本 shell shell命令 类似windows系统的bat 批处理文件 里面都是脚本 CentOS6. ...

  10. C++ 关于MFC List Control 控件的使用事项 原创

    1\在开发项目时,使用到了 listcontrol 控件,就一些问题,做一下备注,以备以后使用 (1)  给list项目 删除所有的项目  DeleteAllItems(); (2) 给list项目 ...