1018 Hammer and scissors cloth (20) (20 points)Everyone should play "Hammer and Scissors Cloth" game: two people at the same time give gestures, the rule of victory:Now give a record of the confrontation between two people, please count the wins, flat, negative number of both sides, and give the two sides what gesture of the greatest odds.Input format:Enter line 1th to give the positive integer n (Output format:Output 1th, 2 respectively give a, B win
#include#includeint main () {int N,MAXA,MAXB; maxa=maxb=-1;int a[3]={0},b[3]={0};0,1,2 position, respectively, win, draw, failure. Number of fill inint harsh1[3]={0},harsh2[3]={0};0: Cloth, 1 Hammer, 2 scissors: scanf ("%d", n);Forint t=0; TAbsorb extra space to ensure the following inputChar A, B; scanf"%c%c", a,b);if (a==b) {++a[1]; ++b[1]; }else {C Stands for "Hammer", J for "Scissors", B for "cloth"if (a==' C ' b==' J ') {++a[0]; ++b[2]; harsh1[1]+=1; }if (a==' J ' b==' B ') {++a[0]; ++b[2
Title Link: http://www.patest.cn/contests/pat-b-practise/1018Everyone should play "Hammer and Scissors Cloth" game: two people at the same time give gestures, the rule of victory:
Now give a record of the confrontation between two people, please count the wins, flat, negative number of both sides, and give the two sides what gesture of the greatest odds.Input format:Enter the 1th line to give the positive integer n (5), which is the number of times the two sides clash. Then n lines, each r
Title Link: BZOJ-1018Problem analysisThis problem shows that the brush problem is less, the game is easy to kneel. Sdoi Round1 Day2 T3 is similar to this problem. However, I have not done this problem.This problem is a classical model for maintaining the connectivity of line-segment trees.One node of our segment tree represents the connectivity of an interval, with 6 bool values representing the connectivity between points on the 4 corners of the interval.Then the connectivity of the whole inter
Code:#include Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced. Pat (B) 1018. Hammer and scissors cloth
Test instructions: There are n devices, each device has a number of manufacturers, different manufacturers to provide equipment with different bandwidth and price, it is necessary for each device, the total bandwidth for the minimum bandwidth of these n devices, the total price for the sum of the price of these n devices, the maximum total bandwidth/Total price.Solution: Enumeration + pruning. Enumerate the minimum bandwidth, sort all devices, prioritize b->p->id, two pruning: 1. Duplicate B doe
Lining up
Time Limit: 2000MS
Memory Limit: 32768K
Total Submissions: 24786
Accepted: 7767
Description"How am I ever going to solve this problem?" said the pilot.Indeed, the pilot is not facing a easy task. She had to drop packages at specific points scattered in a dangerous area. Furthermore, the pilot could only fly through the area once in a straight line, and she had to fly over as many points as Pos Sible. All points were given
in each state that are not in the state, and then draw a line with two points as the endpoint for state transfer#include #include#include#include#include#include#include#includeusing namespacestd;typedef unsignedLong LongLL;#defineMet (A, B) (Memset (A,b,sizeof (a)))Const intINF = 1e9+7;Const intMAXN = the;Const intMOD =9973;structnode{intx, y;} a[ -];vectorint>g[(1 -)];intdp[(1 -)], N;intline[ -][ -];///Line[i][j] Represents the point that is collinear with the segment IJintMain () {intT, icas
Title Description:
reading the scores of n students, the number of students will be output for a given score.
Input:
The test input contains several test cases, each of which is in the format
Line 1th: N
Line 2nd: The results of n students, two adjacent numbers with a space interval.
Line 3rd: given score
The input ends when the n=0 is read. where n is not more than 1000, the score is (contains) an integer be
There is a mathematical formula to calculate the number of factorial digits1#include 2#include 3#include 4#include 5 #definePi 3.1415926536 #defineE 2.7182818287 using namespacestd;8 9 intMain ()Ten { One AFreopen ("C:\\users\\super\\documents\\cb_codes\\in.txt","R", stdin); - //freopen ("C:\\users\\super\\documents\\cb_codes\\out.txt", "w", stdout); - intN; the DoubleT; -scanf"%d", n); - while(N-- ) { -scanf"%LF", t); + intFAC; -t = log10 (sqrt (2.0* pi * t)) + T * LOG
Big numberTime limit:2000/1000 MS (java/others) Memory limit:65536/32768 K (java/others)Total submission (s): 26383 Accepted Submission (s): 12006Problem DescriptionIn Many applications very large integers numbers are required. Some of these applications is using keys for secure transmission of data, encryption, etc. In this problem you is given a number, you has to determine the number of digits in the factorial of the number.Inputinput consists of several lines of integer numbers. The first
Problem DescriptionIn Many applications very large integers numbers are required. Some of these applications is using keys for secure transmission of data, encryption, etc. In this problem you is given a number, you has to determine the number of digits in the factorial of the number.Inputinput consists of several lines of integer numbers. The first line contains a integer n, which is the number of cases to being tested, followed by n lines, one integer 1≤n≤ 107 on all line.Outputthe output cont
Big Numberproblem DescriptionIn Many applications very large integers numbers are required. Some of these applications is using the keys for secure transmission of data,Encryption, etc. In this problem you is given a number, you had to determine the number of digits in thefactorialof the number.Inputinput consists of several lines of integer numbers. The first line contains a integer n, which is the number of cases to being tested, followed by n lines, one integer 1≤n≤ 107 on all line.Outputthe
Main topic: To Buy n parts, each part can be supplied by m manufacturers, each part has corresponding B value and P value. (only one can be bought per part) now ask you to find the largest min (b)/sum (p)Min (b) represents the minimum B value for each partSUM (p) represents the P-value of each part andProblem-solving ideas: direct violence#include #include #include using namespace STD;#define MAXNstructdevice{intb, p;} D[MAXN][MAXN];intNUM[MAXN];intNintcmpConstDevice A,ConstDevice b) {returnA.P
Title Description:Reading the scores of n students, the number of students will be output for a given score.Input:The test input contains several test cases, each of which is in the formatLine 1th: NLine 2nd: The results of n students, two adjacent numbers with a space interval.Line 3rd: given scoreThe input ends when the n=0 is read. where n is not more than 1000, the score is (contains) an integer between 0 and 100.Output:For each test case, you will get the student number output for a given s
Question link: http://acm.hdu.edu.cn/showproblem.php? PID = 1, 1018
Problem solving Report: Enter N and ask n! Number of digits.
First, the number of digits x = (INT) log10 (x) + 1;
So n! The number of digits = (INT) log10 (1*2*3 * ...... n) + 1;
= (INT) (log10 (1) + log10 (2) + log10 (3) + ...... log10 (N) + 1;
1 # include View code
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.