1281 凸多边形对角线对角线问题;
统计问题
Description
给出一个带n个顶点的凸多边形,我们保证它不存在3条对角线相交于同一个点。请统计每两条对角线的交点数的和。n=6时,图中的15个圆点即为所求交点
Input
输入只含一个整数n(3≤n≤100)。
Output
输出交点数。
Sample Input
6
Sample Output
15
Hint
一个多边形是凸多边形当且仅当每个内角都小于180°。
代码:
#include <>
int main()
{
int n;
while(scanf("%d",&n)!=EOF)
{
int allb;
allb=n*(n-1)*(n-2)*(n-3)/24;
printf("%d\n",allb);
}
return 0;
}
1341 巧用异或
Who will be punished
Description
This time,suddenly,teacher Li wants to find out who have missed interesting DP lesson to have students who are found out will get strictly ,teacher Li wants all the students master the DP algorithm.
However,Li doesn't want to waste the class time to call over the names of he let the students to write down their names in one his satisfaction,this time, only one student has not come.
He can get the name who has not come to class,but,it is troublesome,and,teacher always have many things to think about,so,teacher Li wants you, who is in the ACM team, to pick out the name.
Input
There are several test first line of each case have one positive integer is the number of the students,and N will not greater than 500,000.
Then,following N lines,each line contains one name of students who have attended N-1 lines are presented after N N-1 lines indicates the names of students who have come to class this time,one name in one line.
The length of student's name is not greater than 30.
Process to the end of file.
Output
For each test case, first print a line saying "Scenario #k", where k is the number of the test output the name of the student who have not come to case per a blank line after each test case, even after the last one.
Sample Input
3
A
B
C
B
C
Sample Output
Scenario #1
A
代码A:
#include <iostream>
#include <cstdio>
#includ
巧妙的方法 来自淘豆网m.daumloan.com转载请标明出处.