标签:style blog class code tar color get int string 2014 404
#include <stdio.h>
#include <string.h>
const int N = 1000005;
int n;
long long ans[N];
int main() {
ans[3] = 0;
for (long long i = 4; i <= 1000000; i++) {
ans[i] = ans[i - 1] + ((i - 1) * (i - 2) / 2 - (i - 1) / 2) / 2;
}
while (~scanf("%d", &n) && n >= 3) {
printf("%lld\n", ans[n]);
}
return 0;
}UVA 11401 - Triangle Counting(数论+计数问题),码迷,mamicode.com
UVA 11401 - Triangle Counting(数论+计数问题)
标签:style blog class code tar color get int string 2014 404
原文地址:http://blog.csdn.net/accelerator_/article/details/24743209