当前位置: 首页 > 工具软件 > Bronze > 使用案例 >

Promotion Counting【USACO 2016 January Contest, Bronze】

晋奕
2023-12-01

       今天来分享一下我做过的几道Usaco的比较简单的题,Usaco是美国的一个c++竞赛比赛,但是全球各地的人都可以参加,Usaco没有监考,全凭诚信,但是你拿着这个 作弊 借鉴来的成绩,所有美国的大学都会把你拒之门外,其他国家我就不大清楚了。好像也许可能是因为系统会自动给你评估实力,判断有没有 作弊 emm......

        好啦,废话少说,上题目!

题目大意:

Bessie the cow is helping Farmer John run the USA Cow Olympiad (USACO), an on-line contest where participants answer challenging questions to demonstrate their mastery of bovine trivia.

In response to a wider range of participant backgrounds, Farmer John recently expanded the contest to include four divisions of difficulty: bronze, silver, gold, and platinum. All new participants start in the bronze division, and any time they score perfectly on a contest they are promoted to the next-higher division. It is even possible for a participant to be promoted several times within the same contest. Farmer John keeps track of a list of all contest participants and their current divisions, so that he can start everyone out at the right level any time he holds a contest.

When publishing the results from his most recent contest, Farmer John wants to include information on the number of participants who were promoted from bronze to silver, from silver to gold, and from gold to platinum. However, he neglected to count promotions as they occurred during the contest. Bessie, being the clever bovine she is, realizes however that Farmer John can deduce the number of promotions that occurred solely from the number of participants at each level before and after the contest. Please help her perform this computation!

奶牛贝西正在帮助农民约翰举办美国奶牛奥林匹克竞赛(USACO),这是一项在线竞赛,参赛者回答具有挑战性的问题,以展示他们对牛的知识的掌握。

因为参与者很多,农夫约翰最近将比赛扩大到四个难度级别:青铜、白银、黄金和白金。所有的新参赛者都从青铜级别开始,只要他们在比赛中取得完美的成绩,他们就会被提升到下一个更高的级别。一个参赛者甚至有可能在同一场比赛中多次获得晋升。农夫约翰记录了所有参赛者的名单和他们目前所在的级别,这样他就可以在任何时候举办比赛时让每个人都处于正确的级别。

在公布最近一次比赛的结果时,农夫约翰想要统计从青铜到白银、从白银到黄金、从黄金到白金的晋级人数。他在比赛中忘记了记录了晋升次数。贝西是一头聪明的牛,她意识到,农夫约翰可以从比赛前后每个级别的参赛者数量推断出晋升次数。请帮她做这个计算!

是不是有亿点长?看后头!

样例输入:

输入由四行组成,每一行包含0..1,000,000范围内的两个整数。第一行是比赛前后的青铜人数。第二行是比赛前后的白银人数。第三行指定了比赛前后的黄金人数。最后一行指定了比赛前后的白金人数。
1 2
1 1
1 1
1 2

样例输出:

请输出三行,每一行包含一个整数。第一行应该包含从青铜提升到白银的参与者人数。第二行应该包含从白银晋升到黄金的参与者人数。最后一行应该包含从黄金晋升到白金的参与者人数。
1
1
1

在本例中,每个组别在比赛前都有一名参赛者登记。比赛结束时,两名选手分别获得青铜和白金。其中一种可能发生的情况是,有两名新参与者参加了比赛;其中一个被提升到白金级别,而另一个则保持在青铜级别。

       其实这个考试主要是考察你的思维能力,代码其实非常简单。本题就是典型,有些甚至for循环都不用,直接几个cin,cout,完事儿!这题其实非常简单,因为输出的就是几次考试前后的差,所以本题就是我说的几个cin,cout就完事儿的题,具体作者也只能帮你们帮到这了,看代码自己领悟吧!见下⬇

#include<bits/stdc++.h>
using namespace std;
int a1,a2,b1,b2,c1,c2,d1,d2;
int main(){
	cin>>a1>>a2>>b1>>b2>>c1>>c2>>d1>>d2;
	cout<<b2+c2+d2-b1-d1-c1<<endl;
	cout<<c2+d2-d1-c1<<endl;
	cout<<d2-d1<<endl;
	return 0;
}

是不是灰常简单?简直简单到我怀疑人生呀!

小投票:为什么Usaco都和奶牛有关?

作者初出茅庐,作品可能还有需要完善的地方,请大家在评论区指出,不喜勿喷,蟹蟹。

 类似资料:

相关阅读

相关文章

相关问答