Skip to content

Instantly share code, notes, and snippets.

@mfrazi
Created December 17, 2015 09:16
Show Gist options
  • Save mfrazi/feb46e18e2f45603468e to your computer and use it in GitHub Desktop.
Save mfrazi/feb46e18e2f45603468e to your computer and use it in GitHub Desktop.
#include <stdio.h>
#include <string.h>
int main(){
char data[100];
scanf("%s", data);
int Q=0, W=0, E=0, i, awal=0;
for(i=0; i<strlen(data); i++){
//printf("%c %d %d %d %d\n", data[i], Q, W, E, awal);
if(data[i]=='R'){
if(Q+W+E==3){
if(Q==1 && W==1 && E==1)
printf("Defeaning Blast\n");
else if(Q==3)
printf("Cold Snap\n");
else if(Q==2 && W==1)
printf("Ghost Walk\n");
else if(Q==2 && E==1)
printf("Ice Wall\n");
else if(W==3)
printf("EMP\n");
else if(W==2 && Q==1)
printf("Tornado\n");
else if(W==2 && E==1)
printf("Alacrity\n");
else if(E==3)
printf("Sun Strike\n");
else if(E==2 && Q==1)
printf("Forge Spirit\n");
else if(E==2 && W==1)
printf("Chaos Meteor\n");
}
else
printf("Invoke Failed!\n");
}
if(Q+W+E==3){
if(data[awal]=='Q')
Q--;
else if(data[awal]=='W')
W--;
else if(data[awal]=='E')
E--;
awal++;
while(data[awal]=='R')
awal++;
}
if(data[i]=='Q')
Q++;
else if(data[i]=='W')
W++;
else if(data[i]=='E')
E++;
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment