Advertisement
a53

oji-Ceas1

a53
Mar 18th, 2022
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.86 KB | None | 0 0
  1. ///100p
  2. #include <fstream>
  3. using namespace std;
  4. ifstream fin("ceas.in");
  5. ofstream fout("ceas.out");
  6. int n,C,k;
  7. int main()
  8. {
  9. fin>>C>>k>>n;
  10. ///cerinta C=1
  11. int nr_k=0,nr_t=0,x;
  12. if(C==1)
  13. {
  14. for(int i=1; i<=n; i++)
  15. {
  16. fin>>x;
  17. if(x==k) nr_k++;
  18. else
  19. while(x>0)
  20. {
  21. if(x%10==k) nr_k++;
  22. x/=10;
  23. }
  24. }
  25. fout<<nr_k;
  26. }
  27. if(C==2)///cerinta C=2
  28. {
  29. for(int i=1; i<=n; i++)
  30. {
  31. fin>>x;
  32. while(x>12)
  33. {
  34. if(x%100<=12&&x%100>=10)
  35. x/=100;
  36. else
  37. x/=10;
  38. nr_t++;
  39. }
  40. }
  41. fout<<nr_t;
  42. }
  43. fin.close();
  44. fout.close();
  45. return 0;
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement