标签:
Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 14821 Accepted Submission(s):
9051
import java.util.*;
class Main{
public static void main(String args[])
{Scanner cin=new Scanner(System.in);
while(cin.hasNext())
{int n=cin.nextInt();
if(n==1)
System.out.println("1");
else{
int sum=1;
for(int i=2;i*i<=n;i++)
{if(n%i==0&&i!=n/i)
sum+=2;
else if(n%i==0&&n/i==i)
sum+=1;
}
int f=1;
for(int i=1;i<=sum;i++)
{if(f==1)
f=f-1;
else if(f==0)
f=f+1;
}
System.out.println(f);
}
}
}
}
这个题目有规律的,多写几个你就会发现规律的。
标签:
原文地址:http://www.cnblogs.com/1314wamm/p/5359244.html