写这道题题解的目的就是纪念一下半个小时才读懂题...英文一多读一读就溜号... 读题时还时要静下心来... 题目链接: http://codeforces.com/contest/659/problem/B 题意: 给定地区及来自相应地区的人的分数,每个地区选两个分数最高的人 参加区域赛,如果选出的两个人唯一,则输出名字,否则如果还需要进行下一次比赛,输出"?". 分析: 不唯一的情况就是第二个人和第三个人的分数相同嘛...排个序找一下就好了. 代码: #include <bit…
题目链接:http://codeforces.com/problemset/problem/659/B 题意: n个人,m个区.给出n个人的姓名(保证不相同),属于的区域,所得分数.从每个区域中选出成绩最好的两个人去参加比赛,输出这两个人的名字.如果第三个人的成绩和第二个人的成绩相同,则输出“?”,保证结果不确定. 解题思路: 刚开始想用个什么STL容器把这三个属性存进去,然后根据区域的不同对每个区域的选手的分数进行排序,最后看选手确定,输出答案. 可是做比赛的时候没有想到应该用什么STL容器.…
搞不懂为什么DFS的写法崩了,然后乱暴力,因为题意不是很懂... 主要还是读题吧(很烦 #include <bits/stdc++.h> using namespace std; typedef long long LL; typedef unsigned long long ULL; typedef pair<int,int>PII; const double eps=1e-5; const double pi=acos(-1.0); //const int mod=1e9+7;…
Codeforces 438D The Child and Sequence 给出一个序列,进行如下三种操作: 区间求和 区间每个数模x 单点修改 如果没有第二个操作的话,就是一棵简单的线段树.那么如何处理这个第二个操作呢? 对于一个数a,如果模数 x > a ,则这次取模是没有意义的,直接跳过: 如果 x > a/2 ,则取模结果小于 a / 2; 如果 x < a / 2,取模结果小于x,则也小于 a / 2. 所以对于一个数,最多只会做log a次取模操作.这是可以接受的! 对于一…
题意: 模拟模拟~~ 代码: #include<iostream> using namespace std; const int maxn = 1005; int a[maxn], b[maxn], fa[maxn], fb[maxn]; int main (void) { int n;cin>>n; for(int i = 1; i <= n; i++){ cin>>a[i]; if(i==1) fa[i] = a[i]; else fa[i] = fa[i-1…
https://leetcode.com/problems/add-two-numbers/ You are given two linked lists representing two non-negative numbers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the two numbers and return it as a linked…
题目链接: B. Qualifying Contest time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Very soon Berland will hold a School Team Programming Olympiad. From each of the m Berland regions a team of two…
B. Qualifying Contest 题目连接: http://www.codeforces.com/contest/659/problem/B Description Very soon Berland will hold a School Team Programming Olympiad. From each of the m Berland regions a team of two people is invited to participate in the olympiad.…
B. Qualifying Contest 题目链接http://codeforces.com/contest/659/problem/B Description Very soon Berland will hold a School Team Programming Olympiad. From each of the m Berland regions a team of two people is invited to participate in the olympiad. The q…
time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Very soon Berland will hold a School Team Programming Olympiad. From each of the m Berland regions a team of two people is invited to partici…