OJ#1002 又是a+b】的更多相关文章

题目描述: 给定两个正整数a.b(0 < a,b < =10000),求出a+b的和 输入描述: 多组输入,每组输入为一行,里面有2个数a,b(0 < a,b < =10000) 输出描述: 对于每一组输入,输出一个值为该组a+b的和 样例输入:1 22 3 样例输出:35 解答 #include<stdio.h> int main(){ int a,b; while(scanf("%d%d",&a,&b)!=EOF){ if(a&g…
PKU OJ 1002 487-3279 487-3279 Description Businesses like to have memorable telephone numbers. One way to make a telephone number memorable is to have it spell a memorable word or phrase. For example, you can call the University of Waterloo by dialin…
时间限制:1 秒 内存限制:32 兆 特殊判题:否 提交:18410 解决:4753 题目描述: Grading hundreds of thousands of Graduate Entrance Exams is a hard work. It is even harder to design a process to make the results as fair as possible. One way is to assign each exam problem to 3 indep…
题目连接: http://www.lightoj.com/volume_showproblem.php?problem=1002 题目描述: 有n个城市,从0到n-1开始编号,n个城市之间有m条边,中心城市为t,问每个城市到中心城市的最小路径的花费,路径花费大小的定义为:一条路上花费最大的边的值. 解题思路: Dijkstra的变形,用Dijkstra求出来的单源路径可以保证每条边都是最优的,所以最短路上的最长边就是所求. #include <algorithm> #include <i…
#include <stdio.h> #include <string.h> int main(void) { int q,j,h,k,l; int d; ],s2[];//题目要求位数不大于1000 scanf("%d",&h); ;l<=h;l++){ ]={}, a[]={},b[]={};//这样可以令数组内全部元素为0 scanf("%s %s",&s1,&s2); int cd1,cd2,cd3,cd…
#include<iostream> #include<queue> #include<cstdio> #include<cstring> #include<cmath> #include<algorithm> using namespace std; ][]; int main(){ int P,T,G1,G2,G3,GJ; while(cin>>P>>T>>G1>>G2>>…
#include <iostream> #include <algorithm> using namespace std; int nCases; ], n[]; ], b[]; int main() { scanf("%d", &nCases); ; i <= nCases; ++i) { memset(m, , sizeof(m)); memset(n, , sizeof(n)); getchar(); scanf("%s %s&qu…
题目链接 思路 开个一千万的数组计数,最后遍历即可. #include<stdio.h> #include<string.h> #include<algorithm> using namespace std; int num=0; int mymap[10000000] = {0}; int change(char a[201]) { int j=0, result=0; for(int i=0;i<strlen(a);i++) { if(a[i] == '-')…
[z]http://jingyan.baidu.com/article/5d368d1e182bb93f60c05784.html START WITH CONNECT BY PRIOR这个语法主要用于查询数据包中的树型结构关系.先看下原始数据时怎么样的吧! 表中第一行1001是1002的父节点,而第二行1002又是1003的父节点,如此循环.如题:要求给出其中一个数字能找出其最终的根节点!应该要怎么样实现呢?请看如下sql语句,这里我就拿1008为例.图中第一行第一个num1就是根节点了.再来…
AC通道 神坑的一道题,写了三遍. 两点半开始写的, 第一遍是直接维护两行的二进制.理论上是没问题的,看POJ discuss 上也有人实现了,但是我敲完后准备开始调了.然后就莫名其妙的以为会超时,就删掉了. 第二遍是想错了,因为和之前写过的一道题很像,那道题的正方形最中间不重合即可,所以我以为本质是一样的,然后按照那样的思路写.写写调调到五点半,样例搞掉后,提交,A2T7W1 然后随便找了组数组跟了一下,发现这个方块不允许重合导致这两道题的核心思路差别很大,所以删掉了. 第三遍开始按照自己想的…