Facebook
From trần bá nguyên, 2 Months ago, written in Plain Text.
This paste is a reply to coutnum from trần bá nguyên - go back
Embed
Viewing differences between coutnum and coutnum
#include<bits/stdc++.h>
#include
using namespace std;
long long gcd(long long int a, long long int b) 

  if (b == 0) 
    return a; 
  return gcd(b, a % b); 

long long lcm(int a, int b) 

    return (a / gcd(a, b)) * b; 
}
void solve()
{
 long long a,b,c,d;
 cin>>a>>b>>c>>d;
cin>>a>>b>>c>>d;
    long long p,x,y,z,t=0;
    p=b-a+1;
    x=b/c-(a-1)/c;
    y=b/d-(a-1)/d;
    z=b/lcm(c,d)-(a-1)/lcm(c,d);
    t=x+y-z;
    cout<<p-t;
cout< }
int main()
{
 freopen("countnum.inp","r",stdin);
 freopen("countnum.out","w",stdout);
freopen("countnum.inp","r",stdin);
 freopen("countnum.out","w",stdout);
 solve();
}

Replies to coutnum rss

Title Name Language When
beaunum trần bá nguyên text 2 Months ago.