杭电1002_A + B Problem II】的更多相关文章

这是该题的链接http://acm.hdu.edu.cn/showproblem.php?pid=1002 具体的题的内容就不过多描述了,想必你已经知道了,当我看完这道题后就知道咋写了,可是这道题从开始写到最后accept却花了我好长时间. 先描述一下我的思路,当我看到第二个测试数据后就知道用可以表示范围最大的unsigned long long int 也是无法表示的,之前刷蓝桥杯里面的题,遇到过这种题 因为我对java熟悉一下,所以可以使用BigDecimal解决,或者用数组.所以我果断采用…
#include<stdio.h>#include<string.h> int main(){    char str1[1001],str2[1001];    int t,i,maxlen,len1,len2,k,num=1;    scanf("%d",&t);    getchar();    while(t--)    {        int a[1001]={0},b[1001]={0},c[1001]={0};        scanf(…
Problem Description I have a very simple problem for you. Given two integers A and B, your job is to calculate the Sum of A + B. Input The first line of the input contains an integer T(1<=T<=20) which means the number of test cases. Then T lines fol…
解题思路:对于01背包的状态转移方程式f[v]=max(f[v],f[v-c[i]+w[i]]);其实01背包记录了每一个装法的背包值,但是在01背包中我们通常求的是最优解, 即为取的是f[v],f[v-c[i]]+w[i]中的最大值,但是现在要求第k大的值,我们就分别用两个数组保留f[v]的前k个值,f[v-c[i]]+w[i]的前k个值,再将这两个数组合并,取第k名. 即f的数组会增加一维. http://blog.csdn.net/lulipeng_cpp/article/details/…
Problem Description I have a very simple problem for you. Given two integers A and B, your job is to calculate the Sum of A + B. Input The first line of the input contains an integer T(1<=T<=20) which means the number of test cases. Then T lines fol…
http://acm.hdu.edu.cn/showproblem.php?pid=2058 以为简单的穷举就完了,结果是一直Time Limit Exceeded.. 这是代码: #include <stdio.h> #include <stdlib.h> #include <math.h> int main() { int a,b; int i,j,k; ||b!=)) { ;i<=a;i++) { k = ; *b))+;j++) { k = k+j; if…
http://acm.hdu.edu.cn/showproblem.php?pid=6319 从后往前更新,维护一个递减单调栈(队列) 最近很多题都是单调栈... #define _CRT_SECURE_NO_WARNINGS #include<cstdio> #include<algorithm> #include<queue> #include<iostream> //#include<deque> using namespace std;…
#include<stdio.h> int main() { int m; int i; scanf("%d", &m); ]; int y; int z; ; i < m; i++) { scanf("%s %d", &x, &y); ] >= ] <= 'Z') { z=(x[] - ; y = y + z; } else { z=(x[] - )*(-); y = y + z; } printf("…
杭电ACM(1002)大数相加 A + B Problem II Problem DescriptionI have a very simple problem for you. Given two integers A and B, your job is to calculate the Sum of A + B. InputThe first line of the input contains an integer T(1<=T<=20) which means the number…
最近忙于考试复习,没有多少可供自己安排的时间,所以我利用复习之余的空闲时间去刷刷杭电acm的题目,也当对自己编程能力的锻炼吧. Problem Description I have a very simple problem for you. Given two integers A and B, your job is to calculate the Sum of A + B. Input The first line of the input contains an integer T(1…