#include <cstdio> #include <cstring> #include <iostream> #include <cmath> #define ERROR 1e-11 using namespace std; char input[1000000]; int main() { int counter, i; double sum; char *p; while (gets(input)) { if (!strcmp(input,"*")) break; counter=0; p = strtok(input,"/"); while (p!=NULL) { for (i=0, sum=0 ; p[i]>='A'&&p[i]<='Z' ; i++) { if (p[i]=='W') sum += 1.0; else if (p[i]=='H') sum += 1.0/2.0; else if (p[i]=='Q') sum += 1.0/4.0; else if (p[i]=='E') sum += 1.0/8.0; else if (p[i]=='S') sum += 1.0/16.0; else if (p[i]=='T') sum += 1.0/32.0; else if (p[i]=='X') sum += 1.0/64.0; } if (fabs(sum-1)<ERROR) counter++; p = strtok(NULL,"/"); } printf("%d\n",counter); } return 0; }
Wednesday, November 02, 2011
[UVa] 12195 - Jingle Composing
Subscribe to:
Post Comments (Atom)
Connect Rapoo MT750S with Linux (Tested on Manjaro)
I bought this obvious copy of MX Master 2S in hopes of having the device switching functionality along with a lightweight body because I ha...
-
I like coding a lot, keeps me glued to the PC for hours. For that reason it's a need to edit the Syntax Highlighter to suit my eyes for...
-
I bought this obvious copy of MX Master 2S in hopes of having the device switching functionality along with a lightweight body because I ha...
-
Install MinGW GCC Port on Windows. 1. Just go to this address [ http://sourceforge.net/projects/mingw/files/Installer/mingw-get-inst/ ]...
No comments:
Post a Comment
Post your comment here. If you want to say something about programming problems, scripts, software etc, please try to be as descriptive as possible.