开机,登陆ACM平台,摩拳擦掌跃跃欲试。11点59分,好!开始狂刷页面,biu~ 于是,第一题是这样的: Problem A Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 65535/65535 K (Java/Others) Total Submission(s): 880 Accepted Submission(s): 104 Problem Description It’s a very simple problem. Given three integers A, B and C, please tell me how many real solutions there exist for the equation: A*x*x + B*x + C = 0. Kill it in one minute! Input The first line of input contains an integer number Q, representing the number of equations to follow. Each of the next Q lines contains 3 integer numbers, separated by blanks, a, b and c, defining an equation. The numbers are from the interval [-1000,1000]. Output For each of the Q equations, in the order given in the input, print one line containing the number of real solutions of that equation. Print “INF” (without quotes) if the equation has an infinite number of real solutions. Sample Input 3 1 0 0 1 0 -1 0 0 0 Sample Output 1 2 INF
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 25563 Accepted Submission(s): 9084
Problem Description
lcy gives a hard puzzle to feng5166,lwg,JGShining and Ignatius: gave a and b,how to know the a^b.everybody objects to this BT problem,so lcy makes the problem easier than begin.
this puzzle describes that: gave a and b,how to know the a^b’s the last digit number.But everybody is too lazy to slove this problem,so they remit to you who is wise.
Input
There are mutiple test cases. Each test cases consists of two numbers a and b(0<a,b<=2^30)
Output
For each test case, you should output the a^b’s last digit number.
Sample Input
7 66 8 800
Sample Output
9 6
首先放上代码:
#include
int main()
{
long a,b;
int temp;
while(scanf("%ld%ld",&a,&b)!=EOF)
{
a=a%10;
b=(b>4)?b%4:b;
if(b==0)
{
b=4;
}
for(temp=1;b>0;b--)
{
temp=temp*a;
}
printf("%dn",temp%10);
}
return 0;
}
#include
int main()
{
int y,m,d,sum;
while(~scanf("%d/%d/%d",&y,&m,&d))
{
sum=0;
switch(m)
{
case 12:sum+=30;
case 11:sum+=31;
case 10:sum+=30;
case 9:sum+=31;
case 8:sum+=31;
case 7:sum+=30;
case 6:sum+=31;
case 5:sum+=30;
case 4:sum+=31;
case 3:if((y%4==0)&&((y%100)!=0)||(y%400==0))
sum+=29;
else
sum+=28;
case 2:sum+=31;
case 1:sum+=d;
}
printf("%dn",sum);
sum=0;
}
return 0;
}