• 博客园logo
  • 会员
  • 众包
  • 新闻
  • 博问
  • 闪存
  • 赞助商
  • HarmonyOS
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
dwtfukgv
博客园    首页    新随笔    联系   管理    订阅  订阅
HDU 5703 Desert (找规律)

题意:一杯水有n的容量,问有多少种方法可以喝完。

析:找规律,找出前几个就发现规律了,就是2的多少次幂。

代码如下:

#include <cstdio>
#include <string>
#include <cstdlib>
#include <cmath>
#include <iostream>
#include <cstring>
#include <set>
#include <queue>
#include <algorithm>
#include <vector>
#include <map>
using namespace std ;
typedef long long LL;
typedef pair<int, int> P;
const int INF = 0x3f3f3f3f;
const double inf = 0x3f3f3f3f3f3f3f;
const double eps = 1e-8;
const int maxn = 1000 + 5;
const int dr[] = {0, 0, -1, 1};
const int dc[] = {-1, 1, 0, 0};
int n, m;
struct node{
    string s;
    int id;
    bool operator < (const node &p) const{
        return p.id < id;
    }
};
vector<node> v;

int main(){
    int T;  cin >> T;
    while(T--){
        scanf("%d", &n);
        printf("1");
        for(int i = 1; i < n; ++i)
            printf("0");
        printf("\n");
    }
    return 0;
}

 

posted on 2016-07-29 18:08  dwtfukgv  阅读(200)  评论(0)    收藏  举报
刷新页面返回顶部
博客园  ©  2004-2025
浙公网安备 33010602011771号 浙ICP备2021040463号-3