URAL 1264 Workdays (水)
来源:互联网 发布:闲鱼 淘宝介入 卖家赢 编辑:程序博客网 时间:2024/05/18 00:06
Workdays
Time limit: 1.0 second
Memory limit: 64 MB
Memory limit: 64 MB
After a success of the previous Vasechkin’s program that allowed to calculate the results of the elections in cause of two days Artemy Sidorovich was placed at the head of the department. At the moment Artemy Sidorovich prepares a task for his subordinate — programmer Petechkin. The task is to write a very useful function that would ease the life of all the department programmers. For each integer from 0 to M the function would calculate how many times this number appears in the N-element array. Artemy Sidorovich deems that the function should work as follows (the sample code for N = 3,M = 1):
if (arr[0]==0) ++count[0];if (arr[0]==1) ++count[1];if (arr[1]==0) ++count[0];if (arr[1]==1) ++count[1];if (arr[2]==0) ++count[0];if (arr[2]==1) ++count[1];
if arr[0]=0 then count[0] := count[0] + 1;if arr[0]=1 then count[1] := count[1] + 1;if arr[1]=0 then count[0] := count[0] + 1;if arr[1]=1 then count[1] := count[1] + 1;if arr[2]=0 then count[0] := count[0] + 1;if arr[2]=1 then count[1] := count[1] + 1;
Artemy Sidorovich wants to estimate the time that Petechkin will need to execute the task. We know that Petechkin needs one second to write a line of the code (he’s fast, isn’t he?). Artemy Sidorovich doesn’t know exactly bounds for M and N. Your task is to write program that would calculate a number of seconds that Petechkin will write the code.
Input
The only line contains integers N (0 ≤ N ≤ 40000) and M (0 ≤ M ≤ 40000).
Output
Output an amount of seconds that Petechkin needs to write the program.
Sample
3 1
6
解析:m从0开始,所以结果是n * (m + 1)。
AC代码:
#include <cstdio>int main(){ int n, m; while(~scanf("%d%d", &n, &m)){ printf("%d\n", n * (m + 1)); } return 0;}
PS:读完题,好久没敢写。。。竟然就是这样。。。
0 0
- URAL 1264 Workdays (水)
- URAL 1264. Workdays
- workdays.c
- URAL - 1796 Amusement Park(水)
- URAL 1935. Tears of Drowned (水)
- URAL 1820 Ural Steaks (贪心)
- URAL - 1820 Ural Steaks(小学生题)
- URAL 2067 水dp
- Labyrinth (URAL 1033)
- URAL 1104(数论)
- URAL 1113(数学)
- URAL
- 【ural】
- URAL
- URAL
- URAL
- URAL
- URAL
- java 配数据源连接池详解
- 第16章 进程管理
- 直接拿来用!最火的Android开源项目(一)
- mysql 查看锁表解锁
- GPL, LGPL, BSD协议介绍
- URAL 1264 Workdays (水)
- HDU 5137 How Many Maos Does the Guanxi Worth(floyd记录路径)
- cocoapods(初步)
- spring-aop-@Aspect详细用法
- Typeclassopedia 阅读笔记:导言与 Functor
- github分享
- ANDROID模拟火花粒子的滑动喷射会不停的喷射火花粒子
- Two Sum II - Input array is sorted
- android的键盘问题