fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. char buff[1<<24];
  4. unsigned long long h;
  5. string code[11] = {
  6. "",
  7. "1100111",
  8. "1001000",
  9. "0000101",
  10. "1101100",
  11. "0010011",
  12. "1100010",
  13. "1100011",
  14. "1000000",
  15. "0101000",
  16. "0011000",
  17. };
  18. int ans[11] = {
  19. 0,
  20. 299998,
  21. 639491,
  22. 421316,
  23. 180893,
  24. 187755,
  25. 244082,
  26. 39323,
  27. 298005,
  28. 14109,
  29. 226120,
  30. };
  31.  
  32. string curr;
  33.  
  34. int main() {
  35. fread(buff,1,sizeof(buff),stdin);
  36. int i,sz=strlen(buff);
  37. for(i=0;i<sz;i++) h*=139,h+=buff[i];
  38. for(i=0;i<7;i++) {
  39. if(h&1) curr.push_back('1');
  40. else curr.push_back('0');
  41. h>>=1;
  42. }
  43. for(i=1;i<=10;i++) {
  44. if(curr==code[i]) {
  45. cout<<ans[i]<<endl;
  46. break;
  47. }
  48. }
  49. return 0;
  50. }
  51.  
Success #stdin #stdout 0s 19848KB
stdin
Standard input is empty
stdout
Standard output is empty