您的位置:首页 > 其它

ZOJ-1350

2013-12-16 11:17 239 查看
import java.util.Scanner;

public class Main
{
public static void main(String[] args)
{
Scanner sc = new Scanner(System.in);

int count = sc.nextInt();

for (int i = 0; i < count; i++)
{
int n = sc.nextInt();
boolean[] array = new boolean
;

for (int j = 1; j <= n; j++)
{
for (int k = 0; k < array.length; k++)
{
if ((k + 1) % j == 0)
array[k] = !array[k];
}
}

int total = 0;
for (int j = 0; j < array.length; j++)
{
if (array[j])
total++;
}
System.out.println(total);
}
}
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: