CF 390B:Inna, Dima and Song
来源:互联网 发布:线列步兵知乎 编辑:程序博客网 时间:2024/06/09 15:14
I与D合奏乐曲。共n个乐章,第i个乐章价值ai,D和I可以在演奏时使乐章的价值变为xi与yi且分别不超过ai,如果能使xi + yi = bi,则听者S将增加愉悦度xi * yi,否则S的愉悦度-1。问一首乐曲能使S的愉悦度最大为何值。
看不懂题目真伤。水题一道。不过要注意特判b[i] == 1的时候。
#include <cstdio>#include <iostream>using namespace std ;int xx[110] = {0} ;int yy[110] = {0} ;int Min(int x , int y) { return (x < y)? x : y ;}int main() { //freopen("in.txt" , "r" , stdin) ; int n , x = 0 , y = 0 ; int ans ; cin >> n ; for (int i = 1 ; i <= n ; i ++) { int a , b ; cin >> a >> b ; xx[a] ++ ; yy[b] ++ ; } for (int i = 0 ; i <= 100 ; i ++) { if (xx[i]) x ++ ; if (yy[i]) y ++ ; } ans = Min(x , y) ; cout << ans << endl ; return 0 ;}
0 0
- CF 390B:Inna, Dima and Song
- 【简单题】-CF-390B-Inna, Dima and Song
- codeforces 390B Inna, Dima and Song
- Codeforces 390B Inna, Dima and Song(贪心)
- Inna, Dima and Song
- codeforces Inna, Dima and Song
- Codeforces Round #229 (Div. 2) B. Inna, Dima and Song
- Codeforces Round #229 (Div. 2) B. Inna, Dima and Song
- Codeforces Round #229 (Div. 2)B. Inna, Dima and Song
- Codeforces Round #229 (Div. 2) B. Inna, Dima and Song
- Codeforces Round #229 (Div. 2)B. Inna, Dima and Song
- Codeforces_390B_Inna, Dima and Song
- CF 272B. Dima and Sequence
- CF 272 B. Dima and Sequence
- CF 272B Dima and Sequence
- CF 460B Little Dima and Equation
- CF 460B .Little Dima and Equation
- CF 460B Little Dima and Equation
- poj 3624:Charm Bracelet
- 排序算法一 冒泡排序
- CF 390A:Inna and Alarm Clock
- JSP,html与javascript
- SSH框架面试题
- CF 390B:Inna, Dima and Song
- CF 390C:Inna and Candy Boxes
- 二级缓存的管理
- poj 1252:Euro Efficiency
- spring整合struts2+hibernate实现查询
- hdu 2157:How many ways??
- CF 390D:Inna and Sweet Matrix
- 大量时移、回看出错
- poj 3070:Fibonacci