首页 > 其他 > 详细

URAL - 1785,1293,1877,1409,1820,1787,1264,2012

时间:2015-07-22 23:01:38      阅读:462      评论:0      收藏:0      [点我收藏+]



开始水URAL,今天先来几个。。


1785. Lost in Localization

Time limit: 1.0 second
Memory limit: 64 MB
The Lavin Interactive Company, which has developed the turn-based strategy Losers-V, is constantly extending its target market by localizing the game to as many languages as it can. In particular, they are interested in creating a version of the game in Anindilyakwa, which is one of the languages spoken by indigenous Australians.
However, the localization is complicated by the fact that Anindilyakwa has no numerals. How can a phrase such as “You have seven black dragons and your enemy has forty black dragons” be translated into this language? The localizers have decided to translate it as follows: “You have few black dragons and your enemy has lots of black dragons.” They have compiled a table showing the rule of replacing numbers of monsters by Anindilyakwa words.
Number Designation in Anindilyakwa
from 1 to 4 few
from 5 to 9 several
from 10 to 19 pack
from 20 to 49 lots
from 50 to 99 horde
from 100 to 249 throng
from 250 to 499 swarm
from 500 to 999 zounds
from 1000 legion
Help the localizers automatize the process. Write a program that would output the appropriate word given the number of monsters.

Input

The only line contains the number of monsters n (1 ≤ n ≤ 2000).

Output

Output the word corresponding to the given number of monsters in the Anindilyakwa language.

Samples

input output
7
several
40
lots
Problem Author: folklore
Problem Source: Ural Regional School Programming Contest 2010



AC代码:

#include <map>
#include <set>
#include <cmath>
#include <deque>
#include <queue>
#include <stack>
#include <cstdio>
#include <cctype>
#include <string>
#include <vector>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm>
#define LL long long
#define INF 0x7fffffff
using namespace std;

int main() {
	int n;
	scanf("%d", &n);
	if(n >= 1 && n <= 4) {
		cout << "few" << endl;
	}
	else if(n >= 5 && n <= 9) {
		cout << "several" << endl;
	}
	else if(n >= 10 && n <= 19) {
		cout << "pack" << endl;
	}
	else if(n >= 20 && n <= 49) {
		cout << "lots" << endl;
	}
	else if(n >= 50 && n <= 99) {
		cout << "horde" << endl;
	}
	else if(n >= 100 && n <= 249) {
		cout << "throng" << endl;
	}
	else if(n >= 250 && n <= 499) {
		cout << "swarm" << endl;
	}
	else if(n >= 500 && n <= 999) {
		cout << "zounds" << endl;
	}
	else if(n >= 1000) {
		cout << "legion" << endl;
	}
	return 0;
}





1293. Eniya

Time limit: 1.0 second
Memory limit: 64 MB
It’s restless now on the slips of the intergalactic port’s sixth dock of planet of Torn. No longer then in a month the reconstruction of the small ironclad corvette “Eniya” will be finished. And again this battle ship and its brave team would have to struggle for the control over plutonium mines of Sibelius. The work cannot be stopped even for a second, self-powered laser welders work round the clock. Joints of robots-repairers fuse because of this permanent work. Nevertheless, they can’t stop not for a single moment.
Now in all this turmoil it is discovered that corvette’s thermopanels again need an urgent processing with thorium sulphide. It is known that the processing of the one square meter of the panel needs 1 nanogramm of sulphide. In general, it is needed to process N rectangular panels, which dimensions are A by B meters. It is necessary to calculate as fast as possible, how much sulphide is needed in general for the processing of all panels of “Eniya”. Moreover, do not forget, that the panels need processing of both sides.

Input

The only line contains integers N (1 ≤ N ≤ 100), A (1 ≤ A ≤ 100), B (1 ≤ B ≤ 100).

Output

Output the weight of thorium sulphide in nanogramms needed for the processing.

Sample

input output
5 2 3
60
Problem Author: Den Raskovalov
Problem Source: IX Open Collegiate Programming Contest of the High School Pupils (13.03.2004)



AC代码:

#include <map>
#include <set>
#include <cmath>
#include <deque>
#include <queue>
#include <stack>
#include <cstdio>
#include <cctype>
#include <string>
#include <vector>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm>
#define LL long long
#define INF 0x7fffffff
using namespace std;

int main() {
	int n, a, b;
	scanf("%d %d %d", &n, &a, &b);
	printf("%d\n", n * a * b * 2); 
	return 0;
}






1877. Bicycle Codes

Time limit: 0.5 second
Memory limit: 64 MB
Den has two four-digit combination locks for protecting his bicycle from thieves. Every evening he arms the bicycle antitheft alarm and fastens the bicycle to a special stand with one of the locks. Den never uses the same lock two evenings in a row. One night a thief tried to open the lock using the code 0000. The alarm went off and the thief hurried away. The next night the thief decided to try the code 0001, then 0002, and so on in ascending order of the number.
Den never changes the codes of his locks. On the night when the thief came for the first time the bicycle was fastened with the first lock.

Input

The first line contains the combination that opens the first lock and the second line contains the combination that opens the second lock. Both combinations are strings consisting of four digits from 0 to 9.

Output

Output “yes” if the thief will open the lock sooner or later and “no” otherwise.

Samples

input output
0001
0000
no
0002
0001
yes
Problem Author: Denis Mukhametianov
Problem Source: Ural Regional School Programming Contest 2011



AC代码:

#include <map>
#include <set>
#include <cmath>
#include <deque>
#include <queue>
#include <stack>
#include <cstdio>
#include <cctype>
#include <string>
#include <vector>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm>
#define LL long long
#define INF 0x7fffffff
using namespace std;

int main() {
	int n, m;
	scanf("%d %d", &n, &m);
	if(!(n & 1) || (m & 1)) {
		cout << "yes" << endl;
	}
	else cout << "no" << endl;
	return 0;
}






1409. Two Gangsters

Time limit: 1.0 second
Memory limit: 64 MB
Two gangsters Harry and Larry had a rest at countryside. They decided to spend some time shooting, so they put several beer cans (no more than 10) on a log. Harry started to shoot cans one after another from the leftmost to the right and Larry – from the rightmost to the left. At some moment it happened so that they shot one and the same can.
Harry got indignant and claimed that Larry owed him a considerable sum of money because Larry deprived him of shooting some more cans. Larry became furious and told Harry that he owed even greater sum of money to Larry because of the same reason. They started to argufy but nobody remembered how many cans there were at the very beginning. And no one of them was going to search cans which was shot. Anyway, each of them remembered exactly how many cans he shot.
Determine how many cans were not shot by Harry and how many cans were not shot by Larry.

Input

The only input line contains two integers — the number of cans shot by Harry and by Larry respectively.

Output

two integers — the number of cans that were not shot by Harry and the number of cans that were not shot by Larry, respectively.

Sample

input output
4 7
6 3
Problem Author: Den Raskovalov
Problem Source: The 12th High School Pupils Collegiate Programming Contest of the Sverdlovsk Region (October 15, 2005)

AC代码:

#include <map>
#include <set>
#include <cmath>
#include <deque>
#include <queue>
#include <stack>
#include <cstdio>
#include <cctype>
#include <string>
#include <vector>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm>
#define LL long long
#define INF 0x7fffffff
using namespace std;

int main() {
	int a, b;
	scanf("%d %d", &a, &b);
	printf("%d %d\n", b - 1, a - 1);
	return 0;
}





1820. Ural Steaks

Time limit: 0.5 second
Memory limit: 64 MB
After the personal contest, happy but hungry programmers dropped into the restaurant “Ural Steaks” and ordered n specialty steaks. Each steak is cooked by frying each of its sides on a frying pan for one minute.
Unfortunately, the chef has only one frying pan, on which at most k steaks can be cooked simultaneously. Find the time the chef needs to cook the steaks.

Input

The only input line contains the integers n and k separated with a space (1 ≤ nk ≤ 1000).

Output

Output the minimal number of minutes in which the chef can cook n steaks.

Sample

input output
3 2
3
Problem Author: Magaz Asanov
Problem Source: XII USU Open Personal Contest (March 19, 2011)


AC代码:

#include <map>
#include <set>
#include <cmath>
#include <deque>
#include <queue>
#include <stack>
#include <cstdio>
#include <cctype>
#include <string>
#include <vector>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm>
#define LL long long
#define INF 0x7fffffff
using namespace std;

int main() {
	int n, k;
	scanf("%d %d", &n, &k);
	
	if(k >= n) {//ÌØÅÐ 
		printf("2\n");
		return 0;
	}
	
	int t = (n * 2) / k;
	if(t * k < n * 2) t ++;
	printf("%d\n", t);
	return 0;
}



1787. Turn for MEGA

Time limit: 1.0 second
Memory limit: 64 MB
A traffic light at the turn for the “MEGA” shopping center from the Novomoskovskiy highway works in such a way that k cars are able to take a turn in one minute. At weekends all the residents of the city drive to the mall to take a shopping, which results in a huge traffic jam at the turn. Administration of the mall ordered to install a camera at the nearby bridge, which is able to calculate the number of cars approaching this turn from the city. The observation started n minutes ago. You should use the data from the camera to determine the number of cars currently standing in the traffic jam.

Input

The first line contains integers k and n (1 ≤ kn ≤ 100), which are the number of cars that can take a turn to “MEGA” in one minute and the number of minutes passed from the beginning of observation. The second line contains space-separated integers a1, …, an (0 ≤ ai ≤ 100), where aiis the number of cars that approached the turn during the i-th minute. The observation started at morning, when there were no cars at the turn.

Output

Output the number of cars currently standing in the traffic jam.

Samples

input output
5 3
6 7 2
0
5 3
20 0 0
5
Problem Author: Bulat Zaynullin
Problem Source: Ural Regional School Programming Contest 2010


AC代码:

#include <map>
#include <set>
#include <cmath>
#include <deque>
#include <queue>
#include <stack>
#include <cstdio>
#include <cctype>
#include <string>
#include <vector>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm>
#define LL long long
#define INF 0x7fffffff
using namespace std;

int main() {
	int k, n, ans = 0;
	scanf("%d %d", &k, &n);
	for(int i = 0; i < n; i ++) {
		int t;
		scanf("%d", &t);
		ans += t;
		ans -= k;
		if(ans < 0) ans = 0;
	}
	printf("%d\n", ans);
	return 0;
}





1264. Workdays

Time limit: 1.0 second
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):
C Pascal
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

input output
3 1
6
Problem Author: Den Raskovalov
Problem Source: Open collegiate programming contest for high school children of the Sverdlovsk region, October 11, 2003



AC代码:

#include <map>
#include <set>
#include <cmath>
#include <deque>
#include <queue>
#include <stack>
#include <cstdio>
#include <cctype>
#include <string>
#include <vector>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm>
#define LL long long
#define INF 0x7fffffff
using namespace std;

int main() {
	int n, m;
	scanf("%d %d", &n, &m);
	printf("%d\n", n * (m + 1));
	return 0;
}






2012. About Grisha N.

Time limit: 1.0 second
Memory limit: 64 MB
Grisha N. told his two teammates that he was going to solve all given problems at the subregional contest, even if the teammates wouldn’t show up at the competition. The teammates didn’t believe Grisha so he told them the plan how he was going to do this.
During the first hour he wants to solve f problems. If there is still some time left to the end of the first hour, Grisha will simply walk along the hall. Beginning from the second hour Grisha wants to spend exactly 45 minutes on each of the problems left. If the plan is a success, will Grisha be able to solve all 12 given problems for 5 hours?

Input

The only line contains an integer f that is the number of problems Grisha wants to solve during the first hour of the competition (1 ≤ f ≤ 11).

Output

Output “YES”, if Grisha manages to solve all the given problems alone, and “NO” if he doesn’t.

Samples

input output
7
YES
5
NO
Problem Author: Alexander Ipatov (prepared by Olga Soboleva)
Problem Source: NEERC 2014, Eastern subregional contest





AC代码:

#include <map>
#include <set>
#include <cmath>
#include <deque>
#include <queue>
#include <stack>
#include <cstdio>
#include <cctype>
#include <string>
#include <vector>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm>
#define LL long long
#define INF 0x7fffffff
using namespace std;

int main() {
	int f;
	scanf("%d", &f);
	if(f >= 7) {
		printf("YES\n");
	}
	else printf("NO\n");
	return 0;
}









版权声明:本文为博主原创文章,未经博主允许不得转载。

URAL - 1785,1293,1877,1409,1820,1787,1264,2012

原文:http://blog.csdn.net/u014355480/article/details/47009339

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!