【CF1068A】Birthday(签到)

题意:有N种棋子,M个人,已有K种收藏,要求最小的每个人送的棋子数使得最坏情况下至少有L种新的收藏,无解输出-1

N,M,K,L<=1e18

思路:

 1 #include<cstdio>
 2 #include<cstring>
 3 #include<string>
 4 #include<cmath>
 5 #include<iostream>
 6 #include<algorithm>
 7 #include<map>
 8 #include<set>
 9 #include<queue>
10 #include<vector>
11 using namespace std;
12 typedef long long ll;
13 typedef unsigned int uint;
14 typedef unsigned long long ull;
15 typedef pair<int,int> PII;
16 typedef vector<int> VI;
17 #define fi first
18 #define se second 
19 #define MP make_pair
20 #define N   1100000
21 #define MOD 1000000007
22 #define eps 1e-8 
23 #define pi acos(-1)
24 
25 
26 int main()
27 {
28     ll n,m,k,l;
29     scanf("%lld%lld%lld%lld",&n,&m,&k,&l);
30     if(n<m||l>n-k) printf("-1\n");
31      else
32      {
33          ll ans=(k+l)/m;
34          if(ans*m<k+l) ans++;
35          if(ans*m<=n) printf("%lld\n",ans);
36           else printf("-1\n");    //7 4 1 6 ANS=-1
37      }    
38     return 0;
39 }

 

posted on 2018-10-25 02:54  myx12345  阅读(180)  评论(0编辑  收藏  举报

导航