Parallel and Perpendicular 几何,数学
Description
You are given a regular n-gon. Your task is to calculate two values: the number of its diagonals that are parallel to at least one of its other diagonals, and the number of its diagonals that are perpendicular to at least one of its diagonals. A diagonal is a segment connecting two non-adjacent polygon vertices.
Input
The only line contains an integer n (4 ≤ n ≤ 10 5).
Output
Output two required numbers.
Sample Input
| input | output |
|---|---|
4 |
0 2 |
int main() { //freopen("in.txt","r",stdin); LL n; while(cin>>n) { LL a,b; if(n == 6) { cout<<6<<" "<<9<<endl; continue; } if(n % 2) { if(n == 5) { a = b = 0; }else { b = 0; a = (n - 3)/2*(n); } }else { if(n != 4) { a = (n-3)*n/2; b = a; } else { a = 0; b = 2; } } cout<<a<<" "<<b<<endl; } return 0; }
posted on 2013-11-15 14:47 keep trying 阅读(246) 评论(0) 收藏 举报
浙公网安备 33010602011771号