1 2
2
ACM_杨延玺
#include
main(){char _[15];gets(_);while(gets(_))puts(_);}
2 Acm ACCEPTED
aCM accepted
#include
int main()
{
int a,b,c,n;
char x;
scanf("%d",&n);
getchar();
while(n--)
{
while(scanf("%c",&x)&&x!='\n')
{
if(x>=97&&x<=122) printf("%c",x-32);
else if(x<=90&&x>=64) printf("%c",x+32);
}
printf("\n");
}
}
1 1
471
#include
int main()
{
long long a,b,c,d,e;
scanf("%lld",&a);
while(a--)
{
scanf("%lld",&b);
printf("%lld\n",(b-1)*1000+471);
}
return 0;
}
小时候学过的九九乘法表也许将会扎根于我们一生的记忆,现在让我们重温那些温暖的记忆,请编程输出九九乘法表.
现在要求你输出它的格式与平常的 不同啊! 是那种反过来的三角形啦,具体如下图:
每两个式子之前用一个空格 隔开。。。
3 2 1 5
1*1=1 1*2=2 1*3=3 1*4=4 1*5=5 1*6=6 1*7=7 1*8=8 1*9=9 2*2=4 2*3=6 2*4=8 2*5=10 2*6=12 2*7=14 2*8=16 2*9=18 1*1=1 1*2=2 1*3=3 1*4=4 1*5=5 1*6=6 1*7=7 1*8=8 1*9=9 1*1=1 1*2=2 1*3=3 1*4=4 1*5=5 1*6=6 1*7=7 1*8=8 1*9=9 2*2=4 2*3=6 2*4=8 2*5=10 2*6=12 2*7=14 2*8=16 2*9=18 3*3=9 3*4=12 3*5=15 3*6=18 3*7=21 3*8=24 3*9=27 4*4=16 4*5=20 4*6=24 4*7=28 4*8=32 4*9=36 5*5=25 5*6=30 5*7=35 5*8=40 5*9=45
#include
int main()
{
int t,n;
scanf("%d",&t);
while(t--)
{
scanf("%d",&n);
for(int i=1;i<=n;i++){
for(int j=i;j<10;j++)
printf("%d*%d=%d ",i,j,i*j);
printf("\n");
}
}
}
3 -11.1 +11.1 0 11 -11.25 -0.25 1 2 +4
Yes Yes No
#include
#include
double a,b,c;
main()
{
for(scanf("%lf",&a);~scanf("%lf%lf%lf",&a,&b,&c);puts(fabs(c-(a+b))<1e-6?"Yes":"No"));
}
Mr. B, Mr. G and Mr. M are now in Warsaw, Poland, for the 2012’s ACM-ICPC World Finals Contest. They’ve decided to take a 5 hours training every day before the contest. Also, they plan to start training at 10:00 each day since the World Final Contest will do so. The scenery in Warsaw is so attractive that Mr. B would always like to take a walk outside for a while after breakfast. However, Mr. B have to go back before training starts, otherwise his teammates will be annoyed. Here is a problem: Mr. B does not have a watch. In order to know the exact time, he has bought a new watch in Warsaw, but all the numbers on that watch are represented in Roman Numerals. Mr. B cannot understand such kind of numbers. Can you translate for him?
I II III IV V VI VII VIII IX X XI XII
Case 1: 1 Case 2: 2 Case 3: 3 Case 4: 4 Case 5: 5 Case 6: 6 Case 7: 7 Case 8: 8 Case 9: 9 Case 10: 10 Case 11: 11 Case 12: 12
#include
5 9 10 7 11 1 6 5 7 3 5 2 7 3 7 6 0
19 13
#include
main(){int n;while(scanf("%d",&n),n){int a,b,s=0;while(n--){scanf("%d%d",&a,&b);if(a+b>s) s=a+b;}printf("%d\n",s);}}
2 1 5
1 1
#include
#include
#include
int a[100], b[101];
int cmp(const void *a, const void *b){
return *(int *)b - *(int *)a;
}
int main(){
int n, m, i, count, t, j;
while(scanf("%d%d", &n, &m) == 2){
if(n == 0 || m == 0) continue;
for(i = 0; i != n; ++i)
scanf("%d", &a[i]);
qsort(a, n, sizeof(int), cmp);
for(i = 0, count = 0; i != n; ++i, count = 0){
for(j = i; j != n; ++j)
if(a[i] == a[j])
++count;
else break;
b[i + 1] = count;
i = j - 1;
}
while(m-- && scanf("%d", &t))
printf("%d\n", b[t]);
memset(b, 0, sizeof(b));
}
return 0;
}
万圣节有一个Party,XadillaX显然也要去凑热闹了。因为去凑热闹的人数非常庞大,几十W的数量级吧,自然要进场就需要有门票了。很幸运的,XadillaX竟然拿到了一张真·门票!这真·门票的排列规则有些奇怪:
门票号是由0~6组成的六位数(0~6这几个数字可重用)
每一个门票号的每一位不能有三个连续相同的数字(如123335是不行的)
每一个门票号相邻的两位相差必须在四以下(≤4)(如016245是不行的)
2 001001 001002 001011 001012
001001 001002 001011 001012
#include
#include
char str[7];
bool Judge(int a){
int i = 0;
while(a){
str[i++] = a % 10 + '0';
if(str[i-1] > '6') return 0;
a /= 10;
}
while(i < 6) str[i++] = '0';
str[i] = '\0';
for(i = 1; i != 6; ++i){
if(str[i] == str[i+1] && str[i] == str[i-1]) return 0;
if(abs(str[i] - str[i-1]) > 4) return 0;
}
return 1;
}
int main(){
int t, a, b, i;
scanf("%d", &t);
while(t--){
scanf("%d%d", &a, &b);
for(i = a; i <= b; ++i)
if(Judge(i)) printf("%06d\n", i);
printf("\n");
}
return 0;
}
3 2
3
#include
int main()
{
int n,k,sum,s;
while(scanf("%d%d",&n,&k)!=EOF)
{
if(n<=k&&n!=0)
sum=2;
else if(n==0)
sum=0;
else
{
s=2*n; //时间 总 和
if(s%k==0)
sum=s/k;
else
sum=s/k+1;
}
printf("%d\n",sum);
}
return 0;
}