Advertisement
Guest User

Untitled

a guest
Nov 19th, 2019
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.61 KB | None | 0 0
  1. #include <fstream>
  2. #include <algorithm>
  3. using namespace std;
  4. int n;
  5. float all[12];
  6. string color, type;
  7. int main(){
  8. ifstream fin("input.txt");
  9. ofstream fout("output.txt");
  10. fin>>n;
  11. for(int i=0;i<n;i++){
  12. fin>>color>>type;
  13. if (color=="white"){
  14. if(type=="pawn"){
  15. all[0]+=0.125;
  16. continue;
  17. }
  18. if(type=="rook"){
  19. all[1]+=0.5;
  20. continue;
  21. }
  22. if(type=="bishop"){
  23. all[2]+=0.5;
  24. continue;
  25. }
  26. if(type=="knight"){
  27. all[3]+=0.5;
  28. continue;
  29. }
  30. if(type=="king"){
  31. all[4]++;
  32. continue;
  33. }
  34. if(type=="queen"){
  35. all[5]++;
  36. continue;
  37. }
  38. }
  39. else if (color=="black"){
  40. if(type=="pawn"){
  41. all[6]+=0.125;
  42. continue;
  43. }
  44. if(type=="rook"){
  45. all[7]+=0.5;
  46. continue;
  47. }
  48. if(type=="bishop"){
  49. all[8]+=0.5;
  50. continue;
  51. }
  52. if(type=="knight"){
  53. all[9]+=0.5;
  54. continue;
  55. }
  56. if(type=="king"){
  57. all[10]++;
  58. continue;
  59. }
  60. if(type=="queen"){
  61. all[11]++;
  62. continue;
  63. }
  64. }
  65. }
  66. sort(all,all+12);
  67. fout<<(int)all[0];
  68. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement