码迷,mamicode.com
首页 > 其他好文 > 详细

uva10934 Dropping water balloons

时间:2018-10-17 00:27:14      阅读:226      评论:0      收藏:0      [点我收藏+]

标签:cout   sizeof   using   namespace   ring   eof   more   clu   names   

#include<iostream>
#include<cstring>
using namespace std;

const int maxk = 100;
const int maxa = 63;

unsigned long long d[maxk+1][maxa+1];

int main() {
  memset(d, 0, sizeof(d));
  for(int i = 1; i <= maxk; i++)
    for(int j = 1; j <= maxa; j++)
      d[i][j] = d[i-1][j-1] + 1 + d[i][j-1];

  int k;
  unsigned long long n;
  while(cin >> k >> n && k) {
    int ans = -1;
    for(int i = 1; i <= maxa; i++)
      if(d[k][i] >= n)
    {
    ans = i;
    break;
    }
    if(ans < 0)
        cout << "More than " << maxa << " trials needed.\n";
    else
        cout << ans << "\n";
  }
  return 0;
}

 

uva10934 Dropping water balloons

标签:cout   sizeof   using   namespace   ring   eof   more   clu   names   

原文地址:https://www.cnblogs.com/lqerio/p/9800756.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!