标签:
1 1 2 1
2 3
#include<stdio.h>
//#include<bits/stdc++.h>
#include<string.h>
#include<iostream>
#include<math.h>
#include<sstream>
#include<set>
#include<queue>
#include<vector>
#include<algorithm>
#include<limits.h>
#define inf 0x3fffffff
#define lson l,m,rt<<1
#define rson m+1,r,rt<<1|1
#define LL long long
using namespace std;
int main()
{
LL k,a,b;
LL ans=0;
while(cin>>b>>k)
{
LL ans=0;
a=0;
if(a<0&&b<0)
{
ans+=(-a)/k-(-b)/k;
if((-b)%k==0)
{
ans++;
}
}
else if(a<0&&b==0)
{
ans+=(-a)/k;
ans++;
}
else if(a<0&&b>0)
{
ans+=(b)/k+(-a)/k;
ans++;
}
else if(a==0&&b>0)
{
ans+=(b)/k;
ans++;
}
else if(a>0&&b>0)
{
ans+=(b)/k-(a)/k;
if(a%k==0)
{
ans++;
}
}
else if(a==0&&b==0)
{
ans++;
}
cout<<ans<<endl;
}
return 0;
}
湖南工业大学创新实验室2015年新生赛(一)1003(重开)
标签:
原文地址:http://www.cnblogs.com/yinghualuowu/p/4996053.html