SPOJ : ACT solution (Alpha Centauri Tennis)
Spoj:ACT question
Hints:
The winner of the match is the winner of the last game
Solution:
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
int main()
{
int t,n;
char *s;
scanf("%d",&t);
s = (char*)malloc(1000);
while(t--)
{
scanf("%d %s",&n,s);
n=strlen(s)-1;
printf("%c\n",s[n]);
}
return 0;
Spoj:ACT question
Hints:
The winner of the match is the winner of the last game
Solution:
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
int main()
{
int t,n;
char *s;
scanf("%d",&t);
s = (char*)malloc(1000);
while(t--)
{
scanf("%d %s",&n,s);
n=strlen(s)-1;
printf("%c\n",s[n]);
}
return 0;
No comments:
Post a Comment