fork(2) download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. int main() {
  4. string s , d;
  5. cin>>s>>d;
  6. transform(s.begin(),s.end() , s.begin(),::toupper);
  7. transform(d.begin(),d.end() , d.begin(),::toupper);
  8. string arrs[8] = {"TH" , "GA", "IC" , "HA" , "TE", "LU" ,"NI","CA"};
  9. float arr[8]={800,600,750,900,1400,1200,1100,1500};
  10. float res=0;
  11. int st ,ed;
  12. for(int i=0;i<8;i++)
  13. {
  14. if(s==arrs[i])
  15. st=i;
  16.  
  17. if(d==arrs[i])
  18. ed=i;
  19. }
  20. if(st==ed)
  21. {
  22. cout<<" INVALID INPUT";
  23. return 0;
  24. }
  25. else
  26. {
  27. int i=st+1;
  28. cout<<i;
  29. while(i!=ed+1)
  30. {
  31. res+=(arr[i]);
  32. i=(i+1)%8;
  33. }
  34. cout<<(ceil)(res*0.005);
  35. return 0;
  36. }
  37. }
Runtime error #stdin #stdout 0s 4892KB
stdin
Standard input is empty
stdout
Standard output is empty