Codeforce #164 div2

Source: Internet
Author: User

This time, CF remains the same. At my level, I can only do water questions, but the speed ratio is faster than the previous few times ...... I hope it will be faster and faster in the future. Question _ ^ A: After reading the long-winded question, I will be clear about the two cycles and count the same number of main clothing and passenger clothing ...... [cpp] # include <iostream> # include <cstdio> # include <cstring> using namespace std; int n; int home [50], away [50]; int main () {while (cin> n) {for (int I = 0; I <n; I ++) {cin> home [I]> away [I];} int cnt = 0; for (int I = 0; I <n; I ++) {for (int j = 0; j <n; j ++) {if (j! = I & home [I] = away [j]) {cnt ++ }}}cout <cnt <endl;} return 0;} B: A string of passwords. the maximum number of times a button is required to guess. If you guess the current one, continue; if you guess the error, return to the initial position. When you push some button, it either stays pressed into the lock (that means that you 've guessed correctly and pushed the button that goes next in the sequence ), or all pressed buttons return to the initial position. when all buttons are pressed into the lock at once, the lock opens. A few simple examples show the regular [cpp] # include <iostream> # include <cstdio> # include <cstring> using namespace std; int main () {int n; While (cin> n) {int sum = 0; for (int I = 1; I <= n; I ++) {sum + = I * (n-I);} sum + = n; cout <sum <endl;} return 0;} C: in a plane with a given length and width, find the longest sequence of integer points so that the distance between any two points is not an integer. The shortest distance between two Integer Points is Root 2, and the X-axis differs by 1. In this way, the points found in sequence must meet the requirements. [Cpp] # include <iostream> # include <cstdio> # include <cstring> using namespace std; int n, m; int main () {while (cin> n> m) {int k = min (n, m) + 1; cout <k <endl; for (int I = 0; I <= K-1; I ++) {cout <I <''<k-i-1 <endl ;}} return 0 ;}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.