2016-08-15 Problem Solving►UVa UVa 913 - Joana and the Odd Numbers Contents 1. Problem2. Solution3. Code Problem中文網址 Solution如下。 CodeUVa 91312345678910111213#include<cstdio>int main() { long long n, i, sum; while (scanf("%lld", &n) != EOF) { i = (1 + n)*(n / 2 + 1) / 2;//總共有幾個奇數 sum = 3 * (1 + 2 * (i - 2));//最後 3 個相加 = 中間那個 * 3 printf("%lld\n", sum); } return 0;} Newer UVa 512 - Spreadsheet Tracking Older UVa 392 - Polynomial Showdown