Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <math.h>
- using namespace std;
- int main()
- {
- long long n, count, loop;
- cin >> loop;
- while(loop--)
- {
- cin >> n;
- if(n%2)
- {
- cout << 0 << endl;
- continue;
- }
- count = 1;
- for(int i = 2; i < sqrt(n)+1; i++)
- {
- if(n%i)
- continue;
- if(i%2)
- {
- count++;
- continue;
- }
- else
- {
- count++;
- if(!((n/i)%2) && i != n/i)
- count++;
- }
- }
- cout << count << endl;
- }
- return 0;
- }
- //bai f
- #include <iostream>
- #include <string>
- using namespace std;
- int main()
- {
- int q, a, b, c, d;
- string s;
- cin >> s;
- cin >> q;
- int count[256];
- while(q--)
- {
- cin >> a;
- cin >> b;
- cin >> c;
- cin >> d;
- for(int i = 0; i < 256; i++)
- count[i] = 0;
- for(int i = a-1; i <= b-1; i++)
- count[s.at(i)]++;
- for(int i = c-1; i <= d-1; i++)
- count[s.at(i)]--;
- for(int i = 0; i < 256; i++)
- {
- if(count[i] != 0)
- {
- cout << "NO" << endl;
- goto cont;
- }
- }
- cout << "YES" << endl;
- cont: continue;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement