URAL 1264. Workdays
来源:互联网 发布:网络安全保卫大队在哪 编辑:程序博客网 时间:2024/05/20 16:35
1264. 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
很简单的一道题,完全就是小学数学,直接上代码
#include <cstdio>#include <iostream>using namespace std;int main(){ int a,b; while(cin>>a>>b) { cout<<a*(b+1)<<endl; } return 0;}
0 0
- URAL 1264. Workdays
- URAL 1264 Workdays (水)
- workdays.c
- URAL
- 【ural】
- URAL
- URAL
- URAL
- URAL
- URAL
- URAL
- URAL
- URAL
- URAL
- URAL
- URAL
- URAL
- URAL
- java基础——面向对象(一)
- struts1工作原理浅析(一)
- String,strcpy,strcat,strlen
- 常用的Android studio快捷键修改,
- 当今世界十大经典算法
- URAL 1264. Workdays
- 求最长回文子串问题
- Activity启动模式的深入分析
- 括号匹配
- poj 1698Alice's Chance 最大流模板题
- javaScript 顶级对象window
- css控制之浏览器兼容bug
- 快乐的sublime 编译器 第一节(命令面板)
- 概率随机3(对极限定理的认识)