Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<fstream>
- using namespace std;
- ifstream cin("razboi.in");
- ofstream cout("razboi.out");
- const int N=100000;
- int n, i,j, low, nr,prime[N],k=0,s;
- void cas1()
- {
- int cnt1=0,cnt2=0,p;
- for(i=1;i<=n;i++)
- {
- cin>>nr;
- p=nr%10;
- if(p%2==0)
- cnt1++;
- else
- cnt2++;
- }
- cout<<cnt1<<" "<<cnt2;
- }
- int divid(int N) {
- int sum = 1, nrd = 1;
- for(int d = 2; N > 1; ++d) {
- if(1LL*d*d > N) break;
- if(N % d) continue;
- int nrc = 0;
- int act_prod = 1, act_sum = 1;
- while(N % d == 0) {
- act_prod *= d;
- act_sum += act_prod;
- N /= d;
- ++nrc;
- }
- sum *= act_sum;
- nrd *= (nrc+1);
- }
- if(N != 1) {
- nrd *= 2;
- sum = (1LL*sum*(N+1));
- }
- return sum;
- }
- void cas2()
- {
- int cnt1=0,cnt2=0;
- for(i=1;i<=n;i++)
- {
- cin>>nr;
- s=divid(nr);
- if(s%2==0)
- cnt1++;
- else
- cnt2++;
- }
- cout<<cnt1<<" "<<cnt2;
- }
- int main()
- {
- cin>>n>>low;
- if(low==1)
- cas1();
- else
- cas2();
- }
Add Comment
Please, Sign In to add comment