HDU 2520 我是菜鸟,我怕谁
简单题。
附ac代码:
#include <stdio.h> int main(){ int t, n, s, i, v; scanf("%d", &t); while(t-- && scanf("%d", &n)){ s = 0; v = 1; i = 1; while(i <= n){ s += v; ++i; v += 2; if(s >= 10000) s %= 10000; } printf("%d\n", s); } return 0; }
简单题。
附ac代码:
#include <stdio.h> int main(){ int t, n, s, i, v; scanf("%d", &t); while(t-- && scanf("%d", &n)){ s = 0; v = 1; i = 1; while(i <= n){ s += v; ++i; v += 2; if(s >= 10000) s %= 10000; } printf("%d\n", s); } return 0; }