打表的大水题。

 /* 4541 */
#include <cstdio>
#include <cstdlib>
#include <cstring> int a3[] = {, , , };
int a4[] = {, , , };
int a5[] = {, , , , , };
int a6[] = {, , , , , };
int a7[] = {, , };
int a8[] = {, , , , , , , , , , , , };
int a9[] = {, , , , , , , , , , , , , , , , , , , , , }; int main() {
int t, m, n;
int n3, n4, n5, n6, n7, n8, n9;
int i; #ifndef ONLINE_JUDGE
freopen("data.in", "r", stdin);
freopen("data.out", "w", stdout);
#endif n3 = sizeof(a3)/sizeof(int);
n4 = sizeof(a4)/sizeof(int);
n5 = sizeof(a5)/sizeof(int);
n6 = sizeof(a6)/sizeof(int);
n7 = sizeof(a7)/sizeof(int);
n8 = sizeof(a8)/sizeof(int);
n9 = sizeof(a9)/sizeof(int); scanf("%d", &t);
for (i=; i<=t; ++i) {
scanf("%d %d", &n, &m);
printf("Case #%d: ", i);
--m;
if (n == ) {
if (m >= n3)
printf("-1\n");
else
printf("%d\n", a3[m]);
}
if (n == ) {
if (m >= n4)
printf("-1\n");
else
printf("%d\n", a4[m]);
}
if (n == ) {
if (m >= n5)
printf("-1\n");
else
printf("%d\n", a5[m]);
}
if (n == ) {
if (m >= n6)
printf("-1\n");
else
printf("%d\n", a6[m]);
}
if (n == ) {
if (m >= n7)
printf("-1\n");
else
printf("%d\n", a7[m]);
}
if (n == ) {
if (m >= n8)
printf("-1\n");
else
printf("%d\n", a8[m]);
}
if (n == ) {
if (m < n9)
printf("%d\n", a9[m]);
else if (m == n9)
printf("10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\n");
else if (m == n9+)
printf("20000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\n");
else if (m == n9+)
printf("60000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\n");
else if (m == n9+)
printf("100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\n");
else
printf("-1\n");
}
} return ;
}

【HDOJ】4541 Ten Googol的更多相关文章

  1. 【HDOJ】4729 An Easy Problem for Elfness

    其实是求树上的路径间的数据第K大的题目.果断主席树 + LCA.初始流量是这条路径上的最小值.若a<=b,显然直接为s->t建立pipe可以使流量最优:否则,对[0, 10**4]二分得到 ...

  2. 【HDOJ】【3506】Monkey Party

    DP/四边形不等式 裸题环形石子合并…… 拆环为链即可 //HDOJ 3506 #include<cmath> #include<vector> #include<cst ...

  3. 【HDOJ】【3516】Tree Construction

    DP/四边形不等式 这题跟石子合并有点像…… dp[i][j]为将第 i 个点开始的 j 个点合并的最小代价. 易知有 dp[i][j]=min{dp[i][j] , dp[i][k-i+1]+dp[ ...

  4. 【HDOJ】【3480】Division

    DP/四边形不等式 要求将一个可重集S分成M个子集,求子集的极差的平方和最小是多少…… 首先我们先将这N个数排序,容易想到每个自己都对应着这个有序数组中的一段……而不会是互相穿插着= =因为交换一下明 ...

  5. 【HDOJ】【2829】Lawrence

    DP/四边形不等式 做过POJ 1739 邮局那道题后就很容易写出动规方程: dp[i][j]=min{dp[i-1][k]+w[k+1][j]}(表示前 j 个点分成 i 块的最小代价) $w(l, ...

  6. 【HDOJ】【3415】Max Sum of Max-K-sub-sequence

    DP/单调队列优化 呃……环形链求最大k子段和. 首先拆环为链求前缀和…… 然后单调队列吧<_<,裸题没啥好说的…… WA:为毛手写队列就会挂,必须用STL的deque?(写挂自己弱……s ...

  7. 【HDOJ】【3530】Subsequence

    DP/单调队列优化 题解:http://www.cnblogs.com/yymore/archive/2011/06/22/2087553.html 引用: 首先我们要明确几件事情 1.假设我们现在知 ...

  8. 【HDOJ】【3068】最长回文

    Manacher算法 Manacher模板题…… //HDOJ 3068 #include<cstdio> #include<cstring> #include<cstd ...

  9. 【HDOJ】【1512】Monkey King

    数据结构/可并堆 啊……换换脑子就看了看数据结构……看了一下左偏树和斜堆,鉴于左偏树不像斜堆可能退化就写了个左偏树. 左偏树介绍:http://www.cnblogs.com/crazyac/arti ...

随机推荐

  1. app被Rejected 的各种原因翻译。这个绝对有用。

    1. Terms and conditions(法律与条款) 1.1 As a developer of applications for the App Store you are bound by ...

  2. 用微信点单 订餐系统打造属于个人的O2O外卖订餐行业商业平台

    首先,我不能说我是一个成功的微信达人,我也不能说我是一个优秀的互联网专家.但我就眼下所使用的一套订餐系统来讲.正在逐渐的规划一个餐饮行业的商业圈! 我所使用的系统叫"微铺子订餐系统" ...

  3. 百度2014校园招聘算法——给出一组数据A=[a_0, a_1, a-2, ... a_n](当中n可变),打印出该数值元素的全部组合。

    VC++ void StringTest(CString source, CStringArray& dest) { if(source.IsEmpty()) { } else { CStri ...

  4. Lucene和jackson冲突

    今天在使用lucene的时候,想直接在Controller中返回json对象,于是在Spring中配置了JackSon的converter: <bean id="jacksonMess ...

  5. UVA 12378 Ball Blasting Game 【Manacher回文串】

    Ball Blasting Game Morteza is playing a ball blasting game. In this game there is a chain of differe ...

  6. HDU3756

    题意:给定三围空间里面某些点,求构造出一个棱锥,将所有点包含,并且棱锥的体积最小. 输入: T(测试数据组数) n(给定点的个数) a,b,c(对应xyz坐标值) . . . 输出: H(构造棱锥的高 ...

  7. javascript基础之for循环

    1.数组定义声名 var arry = [1,2,3,4,5]   //相当与var arry = Array(1,2,3,4,5) 2.数据的增删改查 var arry = [1,2,3,4,5] ...

  8. css样式之边框和内外边距

    1.css样式之边框:border 实心的边框: <!DOCTYPE html><html> <head> <meta http-equiv="co ...

  9. 排序算法之快速排序 JAVA快速排序算法

    public static void quickSort(int[] arr, int low , int height){ int l=low, h = height; if(low < he ...

  10. 设为首页 收藏(IE可用)

    function SetHome(obj, vrl) { try { obj.style.behavior = 'url(#default#homepage)'; obj.setHomePage(vr ...