2016-06-26 Problem Solving►UVa UVa 12149 - Feynman Contents 1. Problem2. Solution3. Code Problem題目網址中文網址 Solution稍微列一下規律 1 1 + 4 1 + 4 + 9 1 + 4 + 9 + 16 ... CodeUVa 121491234567891011121314151617#include<cstdio>int main(){ int square[101] = {}, ans[101] = {}; for (int i = 0; i < 101; i++) square[i] = i*i; for (int i = 1; i < 101; i++) ans[i] = ans[i - 1] + square[i]; int n; while (scanf("%d", &n) && n) printf("%d\n", ans[n]); return 0;} Newer UVa 12405 - Scarecrow Older UVa 11296 - Counting Solutions to an Integral Equation