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;
}


posted on 2014-02-13 13:51  长木Qiu  阅读(119)  评论(0编辑  收藏  举报