输入包含多个测试样例,以EOF结束。
每一行包含一个字符串 s(长度≤ 10 ),3个整数 n , T , t 。
s,n,T,t 之间都包含一个空格。
字符串s表示算法复杂度,我们保证肯定是O(n*n)或者O(n)。
n , T ,t (1≤ n, T ≤105 , 1≤t≤10 )均表示题目描述中所提到的变量。
n, t , T 均会以数字形式如100000出现,不会以指数形式105或者10^5的形式出现。
Output
对于每一个测试样例,输出yes表示不会超时,输出no表示会超时,输出maybe表示不确定。
Sample Input
O(n) 100000 10000 10
O(n*n) 10000 100 10
Sample Output
yes
maybe
Hint
int型变量可能不易解决这个问题,推荐用double型或者__int64型。
#include
#include
main()
{
long long int a,b,j,n,m,k,len,i,T,t;
char p[5];
while(scanf("%s",&p)!=EOF)
{
scanf("%I64d %I64d %I64d%*c",&n,&T,&t);
len=strlen(p);
if(len==4)
{
m=(T/t)*n;
}
else if(len==6)
{
m=(T/t)*n*n;
}
if(m
开机,登陆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;
}