fork(6) download
  1. #include <string>
  2. #include <iostream>
  3. #include <map>
  4. #include <stdio.h>
  5. #include <fstream>
  6. #include <string.h>
  7. using namespace std;
  8. map<unsigned char, int> freq;
  9. int main()
  10. {
  11. int test;
  12. scanf("%d",&test);
  13. int j = 0;
  14. while( j < test )
  15. {
  16. int pc;
  17. scanf("%d", &pc);
  18. cin.ignore();
  19. int k = 0;
  20. unsigned char ch;
  21. int val;
  22. while(k < pc)
  23. {
  24. cin >> ch >> val;
  25. cin.ignore();
  26. freq[ch] = val;
  27. k++;
  28. }
  29.  
  30. int lines;
  31. scanf("%d", &lines);
  32. cin.ignore();
  33. unsigned char lstr[20000] = {0};
  34. int m = 0;
  35. unsigned long long int sum = 0;
  36. while( m < lines )
  37. {
  38. scanf("%[^\n]", &lstr);
  39. getchar();
  40.  
  41.  
  42. int len = strlen((const char*)lstr);
  43. for( int i = 0; i < len; ++i)
  44. {
  45. unsigned char ch = lstr[i];
  46. if(freq[ch])
  47. {
  48. sum += freq[ch];
  49. }
  50. }
  51. m++;
  52. memset(&lstr, 0, sizeof(lstr));
  53. }
  54. double amount = (double)(sum/100.00);
  55. printf("%.2lf$\n", amount);
  56. freq.clear();
  57. j++;
  58. }
  59. return 0;
  60. }
Success #stdin #stdout 0.01s 2864KB
stdin
4
7
a 3
W 10
A 100
, 10
k 7
. 3
I 13
7
ACM International Collegiate Programming Contest (abbreviated
as ACM-ICPC or just ICPC) is an annual multi-tiered competition
among the universities of the world. The ICPC challenges students
to set ever higher standards of excellence for themselves
through competition that rewards team work, problem analysis,
and rapid software development.
From Wikipedia.
1
a 1
1
a
7
a 3
W 10
A 100
, 10
k 7
. 3
I 13
7
ACM International Collegiate Programming Contest (abbreviated
as ACM-ICPC or just ICPC) is an annual multi-tiered competition
among the universities of the world. The ICPC challenges students
to set ever higher standards of excellence for themselves
through competition that rewards team work, problem analysis,
and rapid software development.
From Wikipedia.
7
a 3
W 10
A 100
, 10
k 7
. 3
I 13
90
ACM International Collegiate Programming Contest (abbreviated
as ACM-ICPC or just ICPC) is an annual multi-tiered competition
among the universities of the world. The ICPC challenges students
to set ever higher standards of excellence for themselves
through competition that rewards team work, problem analysis,
and rapid software development.
From Wikipedia
through competition that rewards team work, problem analysis,
and rapid software development.
ACM International Collegiate Programming Contest (abbreviated
as ACM-ICPC or just ICPC) is an annual multi-tiered competition
among the universities of the world. The ICPC challenges students
to set ever higher standards of excellence for themselves
through competition that rewards team work, problem analysis,
and rapid software development.
From Wikipedia
through competition that rewards team work, problem analysis,
and rapid software development.
ACM International Collegiate Programming Contest (abbreviated
as ACM-ICPC or just ICPC) is an annual multi-tiered competition
among the universities of the world. The ICPC challenges students
to set ever higher standards of excellence for themselves
through competition that rewards team work, problem analysis,
and rapid software development.
From Wikipedia
through competition that rewards team work, problem analysis,
and rapid software development.
ACM International Collegiate Programming Contest (abbreviated
as ACM-ICPC or just ICPC) is an annual multi-tiered competition
among the universities of the world. The ICPC challenges students
to set ever higher standards of excellence for themselves
through competition that rewards team work, problem analysis,
and rapid software development.
From Wikipedia
through competition that rewards team work, problem analysis,
and rapid software development.
ACM International Collegiate Programming Contest (abbreviated
as ACM-ICPC or just ICPC) is an annual multi-tiered competition
among the universities of the world. The ICPC challenges students
to set ever higher standards of excellence for themselves
through competition that rewards team work, problem analysis,
and rapid software development.
From Wikipedia
through competition that rewards team work, problem analysis,
and rapid software development.
ACM International Collegiate Programming Contest (abbreviated
as ACM-ICPC or just ICPC) is an annual multi-tiered competition
among the universities of the world. The ICPC challenges students
to set ever higher standards of excellence for themselves
through competition that rewards team work, problem analysis,
and rapid software development.
From Wikipedia
through competition that rewards team work, problem analysis,
and rapid software development.
ACM International Collegiate Programming Contest (abbreviated
as ACM-ICPC or just ICPC) is an annual multi-tiered competition
among the universities of the world. The ICPC challenges students
to set ever higher standards of excellence for themselves
through competition that rewards team work, problem analysis,
and rapid software development.
From Wikipedia
through competition that rewards team work, problem analysis,
and rapid software development.
ACM International Collegiate Programming Contest (abbreviated
as ACM-ICPC or just ICPC) is an annual multi-tiered competition
among the universities of the world. The ICPC challenges students
to set ever higher standards of excellence for themselves
through competition that rewards team work, problem analysis,
and rapid software development.
From Wikipedia
through competition that rewards team work, problem analysis,
and rapid software development.
ACM International Collegiate Programming Contest (abbreviated
as ACM-ICPC or just ICPC) is an annual multi-tiered competition
among the universities of the world. The ICPC challenges students
to set ever higher standards of excellence for themselves
through competition that rewards team work, problem analysis,
and rapid software development.
From Wikipedia
through competition that rewards team work, problem analysis,
and rapid software development.
ACM International Collegiate Programming Contest (abbreviated
as ACM-ICPC or just ICPC) is an annual multi-tiered competition
among the universities of the world. The ICPC challenges students
to set ever higher standards of excellence for themselves
through competition that rewards team work, problem analysis,
and rapid software development.
From Wikipedia
through competition that rewards team work, problem analysis,
and rapid software development.
stdout
3.74$
0.01$
3.74$
42.50$