Advertisement
kenpro321

Untitled

Apr 20th, 2018
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.04 KB | None | 0 0
  1. #include <iostream>
  2. #include <math.h>
  3.  
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8. long long n, count, loop;
  9. cin >> loop;
  10. while(loop--)
  11. {
  12. cin >> n;
  13. if(n%2)
  14. {
  15. cout << 0 << endl;
  16. continue;
  17. }
  18. count = 1;
  19. for(int i = 2; i < sqrt(n)+1; i++)
  20. {
  21. if(n%i)
  22. continue;
  23. if(i%2)
  24. {
  25. count++;
  26. continue;
  27. }
  28. else
  29. {
  30. count++;
  31. if(!((n/i)%2) && i != n/i)
  32. count++;
  33. }
  34. }
  35. cout << count << endl;
  36. }
  37. return 0;
  38. }
  39. //bai f
  40. #include <iostream>
  41. #include <string>
  42.  
  43. using namespace std;
  44.  
  45. int main()
  46. {
  47. int q, a, b, c, d;
  48. string s;
  49. cin >> s;
  50. cin >> q;
  51. int count[256];
  52. while(q--)
  53. {
  54. cin >> a;
  55. cin >> b;
  56. cin >> c;
  57. cin >> d;
  58. for(int i = 0; i < 256; i++)
  59. count[i] = 0;
  60. for(int i = a-1; i <= b-1; i++)
  61. count[s.at(i)]++;
  62. for(int i = c-1; i <= d-1; i++)
  63. count[s.at(i)]--;
  64. for(int i = 0; i < 256; i++)
  65. {
  66. if(count[i] != 0)
  67. {
  68. cout << "NO" << endl;
  69. goto cont;
  70. }
  71. }
  72. cout << "YES" << endl;
  73. cont: continue;
  74. }
  75. return 0;
  76. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement