Codeforces Round #311 (Div. 2)A Ilya and Diplomas
【比赛链接】click here~~
【题目大意】
n个人,获取一到三等文凭,每门文凭有大小范围。求最后文凭各颁发多少
【解题思路】直接枚举了,
看完题,赶紧写了一发代码,发现竟然错过注冊时间。系统提示不能提交代码。真是醉了~~。以后还是得提前注冊:
A题,比較简单:
我去,昨天发的代码早上交上去竟然WA了,简直打脸~~
更新一下代码
代码:
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
int main()
{
int n,m;
int a1,a2;
int b1,b2;
int c1,c2;
while(cin>>n)
{
cin>>a1>>a2;
cin>>b1>>b2;
cin>>c1>>c2;
int max1,max2,max3;
max1=min(n-b1-c1,a2);
max2=min(n-max1-c1,b2);
max3=n-max1-max2;
cout<<max1<<" "<<max2<<" "<<max3<<endl;
}
return 0;
}
/*
6
1 5
2 6
3 7
output
1 2 3
input
10
1 2
1 3
1 5
output
2 3 5
input
6
1 3
2 2
2 2
output
2 2 2
*/
Codeforces Round #311 (Div. 2)A Ilya and Diplomas的更多相关文章
- Codeforces Round #311 (Div. 2) A. Ilya and Diplomas 水题
A. Ilya and Diplomas Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/557/ ...
- Codeforces Round #297 (Div. 2)C. Ilya and Sticks 贪心
Codeforces Round #297 (Div. 2)C. Ilya and Sticks Time Limit: 2 Sec Memory Limit: 256 MBSubmit: xxx ...
- 贪心 Codeforces Round #297 (Div. 2) C. Ilya and Sticks
题目传送门 /* 题意:给n个棍子,组成的矩形面积和最大,每根棍子可以-1 贪心:排序后,相邻的进行比较,若可以读入x[p++],然后两两相乘相加就可以了 */ #include <cstdio ...
- 递推 Codeforces Round #186 (Div. 2) B. Ilya and Queries
题目传送门 /* 递推:用cnt记录前缀值,查询区间时,两个区间相减 */ #include <cstdio> #include <algorithm> #include &l ...
- A. Ilya and Diplomas( Codeforces Round #311 (Div. 2) )
A. Ilya and Diplomas time limit per test 1 second memory limit per test 256 megabytes input standard ...
- Codeforces Round #311 (Div. 2)
我仅仅想说还好我没有放弃,还好我坚持下来了. 最终变成蓝名了,或许这对非常多人来说并不算什么.可是对于一个打了这么多场才好不easy加分的人来说,我真的有点激动. 心脏的难受或许有点是由于晚上做题时太 ...
- Codeforces Round #311 (Div. 2) A,B,C,D,E
A. Ilya and Diplomas 思路:水题了, 随随便便枚举一下,分情况讨论一下就OK了. code: #include <stdio.h> #include <stdli ...
- Codeforces Round #311 (Div. 2)题解
A. Ilya and Diplomas time limit per test 1 second memory limit per test 256 megabytes input standard ...
- [Codeforces Round #186 (Div. 2)] B. Ilya and Queries
B. Ilya and Queries time limit per test 2 seconds memory limit per test 256 megabytes input standard ...
随机推荐
- android studio使用中碰到Failure [INSTALL_FAILED_OLDER_SDK] 问题
第一次使用Android studio开发.直接新建一个默认项目运行出现:Failure [INSTALL_FAILED_OLDER_SDK] , 网上很多人说修改build.gradle中的mins ...
- input password密码验证跳转页面
代码如下: 查询密码 <input type="password" id="pwd" /> 页面如下: 密码校验成功后跳转页面: window.lo ...
- for循环,字典遍历(二)
#通过列表值,定义一个字典,来获取key和value str_list = [1,3,5,7,9,'i',9,'o',7,'i'] str_dict = {} for i in str_list: # ...
- Getting start with dbus in systemd (03) - sd-bus.h 使用例子 (systemd version>=221)
sd-bus.h 例子 注意: sd-dbus 是systemd提供的lib,但是这个lib,只有在systemd>v221版本后才可以使用,centos 219版本太低,所以不能使用. 参考: ...
- C++ std::map的安全遍历并删除元素的方法
首先我们讲遍历std::map, 大部分人都能写出第一种遍历的方法,但这种遍历删除的方式并不太安全. 第一种 for循环变量: #include<map> #include<stri ...
- 52.基于doc value正排索引的聚合内部原理
主要知识点: 本节没有太懂,以后复习时补上 聚合分析的内部原理是什么????aggs,term,metric avg max,执行一个聚合操作的时候,内部原理是怎样的呢?用了什么样的数据结 ...
- pandas文本处理
import pandas as pd import numpy as np s = pd.Series([', np.nan, 'hj']) df = pd.DataFrame({'key1': l ...
- Django DTL模板语法中的循环的笔记
for...in...笔记: for...in...标签: for...in...类似于Python中的for...in....可以遍历列表.元组.字符串.字典等一切可以遍历的对象.示例代码如下: { ...
- oldboy python 3.5 week 1
#!/usr/bin/env python # -*- coding:utf-8 -*- ------------------------------------------- name = inpu ...
- * format-- set command window output display format
the displayed number may not match the input number due to display format default: 4 decimal syntax: ...