hdu 1695
include<iostream>#include<vector>
#include<algorithm>
#include<cstdio>
#include<queue>
#include<stack>
#include<string>
#include<map>
#include<set>
#include<cmath>
#include<cassert>
#include<cstring>
#include<iomanip>
using namespace std;
#ifdef _WIN32
#define i64 __int64
#define out64 "%I64d\n"
#define in64 "%I64d"
#else
#define i64 long long
#define out64 "%lld\n"
#define in64 "%lld"
#endif
/************ for topcoder by zz1215 *******************/
#define FOR(i,a,b) for( int i = (a) ; i <= (b) ; i ++)
#define FFF(i,a) for( int i = 0 ; i < (a) ; i ++)
#define FFD(i,a,b) for( int i = (a) ; i >= (b) ; i --)
#define S64(a) scanf(in64,&a)
#define SS(a) scanf("%d",&a)
#define LL(a) ((a)<<1)
#define RR(a) (((a)<<1)+1)
#define pb push_back
#define CL(Q) while(!Q.empty())Q.pop()
#define MM(name,what) memset(name,what,sizeof(name))
#define MC(a,b) memcpy(a,b,sizeof(b))
#define MAX(a,b) ((a)>(b)?(a):(b))
#define MIN(a,b) ((a)<(b)?(a):(b))
#define read freopen("in.txt","r",stdin)
#define write freopen("out.txt","w",stdout)
const int inf = 0x3f3f3f3f;
const i64 inf64 = 0x3f3f3f3f3f3f3f3fLL;
const double oo = 10e9;
const double eps = 10e-9;
const double pi = acos(-1.0);
const int maxn = 100011;
i64 euler[maxn];
vector<int>v[maxn];
int a,b,c,d,k;
vector<int>p;
bool isp(int x)
{
for(int i=0;p[i]*p[i]<=x;i++)
{
if(x%p[i]==0)
{
return false;
}
}
return true;
}
void initp()
{
p.clear();
p.pb(2);
for(int i=3;i<maxn;i++)
{
if(isp(i))
{
p.pb(i);
}
}
return ;
}
void Euler()
{
for(int i=0;i<maxn;i++)
{
euler[i]=i;
}
int now,tmp;
for(int i=0;i<p.size();i++)
{
now = tmp = p[i];
while(now<maxn)
{
v[now].pb(tmp);
euler[now]/=tmp;
euler[now]*=tmp-1;
now+=tmp;
}
}
for(int i=1;i<maxn;i++)
{
euler[i]+=euler[i-1];
}
return ;
}
int find(int now,int x,int id=0)
{
int re=0;
int temp;
for(int i=id;i<v[now].size();i++)
{
temp = x/v[now][i];
re += temp;
if(temp)
{
re -= find(now,temp,i+1);
}
}
return re;
}
int main()
{
int T;
initp();
Euler();
cin>>T;
for(int tt=1;tt<=T;tt++)
{
SS(a);SS(b);SS(c);SS(d);SS(k);
printf("Case %d: ",tt);
if(b>d)
{
swap(b,d);
}
if(k==0)
{
printf("0\n");
continue;
}
b/=k;
d/=k;
if(!b)
{
printf("0\n");
}
else
{
&n
补充:软件开发 , C++ ,