Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <string.h>
- int fbi(int satu, int dua)
- {
- if(dua==0) return satu;
- else
- return fbi(dua,satu % dua);
- }
- int tanda[27];
- int tot[101];
- int main()
- {
- int dwi,i,joko,joko1,beda1=0,beda2=0;
- char nopal[101];
- scanf("%d",&dwi);
- for(i=0;i<dwi;i++)
- {
- scanf("%s",nopal);
- for(joko=0;joko<strlen(nopal);joko++)
- {
- if(tanda[nopal[joko]-97]==0)
- {tanda[nopal[joko]-97]=69;
- tot[i]+=1 ;
- }
- }
- memset(tanda,0,sizeof(nopal));
- // printf("%d\n",tot[i]);
- if((i+1)%3==0){
- if(fbi(tot[i-1],tot[i-2])%3==0)
- printf("Congratulation, the gate is opened, but you must continue to try other combination.\n");
- else
- printf("Please try again.\n");
- continue;
- } else if(tot[i]%2==1){
- printf("The puzzle is still unsolved.\n");
- }
- else printf("Somehow the puzzle is solved.\n");
- //memset(tot,0,sizeof(nopal));
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement