Codeforces Round #346 (Div. 2)---E. New Reform E. New Reform time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Berland has n cities connected by m bidirectional roads. No road connects a city…
题目传送门 /* 水题:ans = (1+2+3+...+n) * k - n,开long long */ #include <cstdio> #include <algorithm> #include <cstring> #include <cmath> using namespace std; typedef long long ll; int main(void) //Codeforces Round #304 (Div. 2) A. Soldier…
题目传送门 /* 题意:5种情况对应对应第i或j辆车翻了没 水题:其实就看对角线的上半边就可以了,vis判断,可惜WA了一次 3: if both cars turned over during the collision. 是指i,j两辆车,而不是全部 */ #include <cstdio> #include <algorithm> #include <cstring> #include <cmath> #include <iostream>…
A. Round House 题目连接: http://www.codeforces.com/contest/659/problem/A Description Vasya lives in a round building, whose entrances are numbered sequentially by integers from 1 to n. Entrance n and entrance 1 are adjacent. Today Vasya got bored and dec…
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.…
A. Round House Vasya lives in a round building, whose entrances are numbered sequentially by integers from 1 to n. Entrance n and entrance 1 are adjacent. Today Vasya got bored and decided to take a walk in the yard. Vasya lives in entrance a and he…
E. New Reform time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Berland has n cities connected by m bidirectional roads. No road connects a city to itself, and each pair of cities is connecte…
E. New Reform Berland has n cities connected by m bidirectional roads. No road connects a city to itself, and each pair of cities is connected by no more than one road. It is not guaranteed that you can get from any city to any other one, using only…
C. Tanya and Toys In Berland recently a new collection of toys went on sale. This collection consists of 109 types of toys, numbered with integers from 1 to 109. A toy from the new collection of the i-th type costs i bourles. Tania has managed to col…
B. Qualifying Contest 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 qualifying contest to form teams was held and it was attended…
A. Round House 题目链接http://codeforces.com/contest/659/problem/A Description Vasya lives in a round building, whose entrances are numbered sequentially by integers from 1 to n. Entrance n and entrance 1 are adjacent. Today Vasya got bored and decided t…
前三题水 A #include <bits/stdc++.h> typedef long long ll; const int N = 1e5 + 5; int main() { int n, a, b; std::cin >> n >> a >> b; int bb = b; if (b < 0) bb = -b; while (bb--) { if (b < 0) { a--; } else { a++; } if (a == 0) { a…
A. Calculating Function 水题,分奇数偶数处理一下就好了 #include<stdio.h> #include<iostream> using namespace std; int main() { long long n;scanf("%lld",&n); ==) printf("%lld\n",(n-1LL)/2LL - n); else printf("%lld\n",n/2LL); }…
D. Bicycle Race 题目链接http://codeforces.com/contest/659/problem/D Description Maria participates in a bicycle race. The speedway takes place on the shores of Lake Lucerne, just repeating its contour. As you know, the lake shore consists only of straigh…
C. Tanya and Toys 题目链接http://codeforces.com/contest/659/problem/C Description In Berland recently a new collection of toys went on sale. This collection consists of 109 types of toys, numbered with integers from 1 to 109. A toy from the new collectio…