题目链接: http://codeforces.com/problemset/problem/155/E E. Double Profiles time limit per test 3 secondsmemory limit per test 256 megabytes 问题描述 You have been offered a job in a company developing a large social network. Your first task is connected wit…
题目传送门 /* 贪心:按照能选的个数和点数降序排序,当条件不符合就break,水题啊! */ #include <cstdio> #include <algorithm> #include <cstring> #include <cmath> using namespace std; ; const int INF = 0x3f3f3f3f; struct Card { int a, b; }card[MAXN]; bool cmp(Card x, Car…
A - Hometask 题意:给你一个字符串,然后再给你k个禁止挨在一起的字符串,问你最少删除多少个字符串,使得不会有禁忌的字符串对挨在一起.题目保证每个字符最多出现在一个禁忌中. 题解:由于每个字符只会出现在一个禁忌里面,那么就说明每个询问是独立的.对于每个询问,我们贪心的去处理就好了,就连续的禁忌字符串,我们删除少的那个就好了. #include<bits/stdc++.h> using namespace std; string s,s2; int ans,a,b,m,c,d; int…
题目链接:http://www.codeforces.com/problemset/problem/155/A题意:找到当前最大值或者最小值出现的次数.“当前”的意思差不多是a[i]大于所有a[j](j小于i)或者大于所有a[j].C++代码: #include <iostream> using namespace std; ]; int main() { cin >> n; ; i < n; i++) cin >> a[i]; ], High = a[], cn…
A. I_love_%username% time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Vasya adores sport programming. He can't write programs but he loves to watch the contests' progress. Vasya even has a…
D. Sereja ans Anagrams time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Sereja has two sequences a and b and number p. Sequence a consists of n integers a1, a2, ..., an. Similarly, sequence …
DZY has a hash table with p buckets, numbered from 0 to p - 1. He wants to insert n numbers, in the order they are given, into the hash table. For the i-th number xi, DZY will put it into the bucket numbered h(xi), where h(x) is the hash function. In…
Codeforces Round #272 (Div. 2) A. Dreamoon and Stairs time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Dreamoon wants to climb up a stair of n steps. He can climb 1 or 2 steps at each move.…
Codeforces Round #366 (Div. 2) A I hate that I love that I hate it水题 #I hate that I love that I hate it n = int(raw_input()) s = "" a = ["I hate that ","I love that ", "I hate it","I love it"] for i in ran…
Codeforces Round #354 (Div. 2) Problems     # Name     A Nicholas and Permutation standard input/output 1 s, 256 MB    x3384 B Pyramid of Glasses standard input/output 1 s, 256 MB    x1462 C Vasya and String standard input/output 1 s, 256 MB    x1393…