SCU-4437 Carries】的更多相关文章

SCU 4437  Carries Time Limit:0MS     Memory Limit:0KB     64bit IO Format:%lld & %llu  Practice  Description Carries frog has nn integers a1,a2,…,ana1,a2,…,an, and she wants to add them pairwise. Unfortunately, frog is somehow afraid of carries (进位).…
题意:问任意两对ai,aj相加的总进位数为多少.比如5,6,95分为(5,6)(5,95)(6,95),进位数 = 1 + 2 + 2 = 5 思路:显然暴力是会超时的.我们可以知道总进位数等于每一位进位数之和,所以我们可以把10个位数的进位分开算,每次%10^k,排序后用二分找到刚好的位置,然后算总数. 好像是唯一一次写二分一次A的题. 代码: #include<iostream> #include<algorithm> #include<cstdio> #inclu…
Carries frog has nn integers a1,a2,-,ana1,a2,-,an, and she wants to add them pairwise. Unfortunately, frog is somehow afraid of carries (进位). She defines hardness h(x,y)h(x,y) for adding xxand yy the number of carries involved in the calculation. For…
 SCU 4438 Censor Time Limit:0MS     Memory Limit:0KB     64bit IO Format:%lld & %llu  Practice Description Censor frog is now a editor to censor so-called sensitive words (敏感词). She has a long text pp. Her job is relatively simple -- just to find the…
 SCU 4440 Rectangle Time Limit:0MS     Memory Limit:0KB     64bit IO Format:%lld & %llu  Practice Description Rectangle frog has a piece of paper divided into nn rows and mm columns. Today, she would like to draw a rectangle whose perimeter is not gr…
B. Carries Time Limit: 1000ms Memory Limit: 65536KB frog has n integers a1,a2,-,an, and she wants to add them pairwise. Unfortunately, frog is somehow afraid of carries (进位). She defines \emph{hardness} h(x,y) for adding x and y the number of carries…
A - A Time Limit:0MS     Memory Limit:0KB     64bit IO Format:%lld & %llu Submit Status Practice SCU 4424 Description Time Limit: 1000ms Description Given N distinct elements, how many permutations we can get from all the possible subset of the eleme…
I NEED A OFFER!     64bit IO Format: %lld & %llu Submit Status Description Description Speakless很早就想出国,现在他已经考完了所有需要的考试,准备了所有要准备的材料, 于是,便需要去申请学校了.要申请国外的任何大学,你都要交纳一定的申请费用, 这可是很惊人的.Speakless没有多少钱,总共只攒了n万美元.他将在m个学校中选择若干的 (当然要在他的经济承受范围内).每个学校都有不同的申请费用a(万美…
SCU - 4440 Rectangle Time Limit: Unknown   Memory Limit: Unknown   64bit IO Format: %lld & %llu Submit Status Description Rectangle frog has a piece of paper divided into n rows and m columns. Today, she would like to draw a rectangle whose perimeter…
4436: Easy Math Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.scu.edu.cn/soj/problem.action?id=4436 Description Given n integers a1,a2,…,an, check if the sum of their square root a1+a2+…+an is a integer. Input The input consists of multiple…
Count The CarriesTime Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hust.edu.cn/vjudge/contest/view.action?cid=87326#problem/C Description One day, Implus gets interested in binary addition and binary carry. He will transfer all decimal digits t…
题目链接:http://acm.scu.edu.cn/soj/problem/4440/ 题目大意:给一个n*m的方格,求周长小于等于k的矩形有多少个. 解题思路:我之前直接暴力,显然超时,所以后来发现,可以用等差数列的求前n项和公式来代替一层for循环,这样就只有一重循环了,不会超时. AC代码: #include <cstdio> #include <cmath> #include <cstring> #include <algorithm> #incl…
题目链接:http://acm.scu.edu.cn/soj/problem/4436/ 题意:给你n个整数,求这n个数的平方根和是否是一个整数: 解题思路:如果这题每个数给他算出来,必然费时间,可能还会超精度,所以巧妙的方法就是判断这些整数是否全是完全平方数,如果有一个不是,则他们的平方根和肯定不是一个整数. AC代码: #include <cstdio> #include <cmath> #include <cstring> #include <algorit…
点击打开链接 Count The Carries Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 65535/32768 K (Java/Others) Total Submission(s): 672    Accepted Submission(s): 230 Problem Description One day, Implus gets interested in binary addition and binary car…
题意:N个点.M条边(2 <= N <= 1000 , 0 <= M <= 10^5),每一个点有个权值W(0 <= W <= 10^5),现要去除一些点(不能去掉点0),使得结点 0 与结点 N - 1 不连通,求去掉的点的最小权值和. 题目链接:http://cstest.scu.edu.cn/soj/problem.action?id=3254 -->>这是很明显的最小点权割.. 建图方案: 1)将全部点 i 拆成 i 和 i + N.i ->…
POJ 2152 fire / SCU 2977 fire(树型动态规划) Description Country Z has N cities, which are numbered from 1 to N. Cities are connected by highways, and there is exact one path between two different cities. Recently country Z often caught fire, so the governm…
POJ 2289 Jamie's Contact Groups / UVA 1345 Jamie's Contact Groups / ZOJ 2399 Jamie's Contact Groups / HDU 1699 Jamie's Contact Groups / SCU 1996 Jamie's Contact Groups (二分,二分图匹配) Description Jamie is a very popular girl and has quite a lot of friends…
POJ 1087 A Plug for UNIX / HDU 1526 A Plug for UNIX / ZOJ 1157 A Plug for UNIX / UVA 753 A Plug for UNIX / UVAlive 5418 A Plug for UNIX / SCU 1671 A Plug for UNIX (网络流) Description You are in charge of setting up the press room for the inaugural meet…
POJ 2502 Subway / NBUT 1440 Subway / SCU 2186 Subway(图论,最短距离) Description You have just moved from a quiet Waterloo neighbourhood to a big, noisy city. Instead of getting to ride your bike to school every day, you now get to walk and take the subway.…
POJ 1511 Invitation Cards / UVA 721 Invitation Cards / SPOJ Invitation / UVAlive Invitation Cards / SCU 1132 Invitation Cards / ZOJ 2008 Invitation Cards / HDU 1535 (图论,最短路径) Description In the age of television, not many people attend theater perfor…
POJ 1502 MPI Maelstrom / UVA 432 MPI Maelstrom / SCU 1068 MPI Maelstrom / UVALive 5398 MPI Maelstrom /ZOJ 1291 MPI Maelstrom (最短路径) Description BIT has recently taken delivery of their new supercomputer, a 32 processor Apollo Odyssey distributed shar…
POJ 1797 Heavy Transportation / SCU 1819 Heavy Transportation (图论,最短路径) Description Background Hugo Heavy is happy. After the breakdown of the Cargolifter project he can now expand business. But he needs a clever man who tells him whether there reall…
HDU 1686 Oulipo / POJ 3461 Oulipo / SCU 2652 Oulipo (字符串匹配,KMP) Description The French author Georges Perec (1936–1982) once wrote a book, La disparition, without the letter 'e'. He was a member of the Oulipo group. A quote from the book: Tout avait…
Zynq7000术语详解,不懂啥是PL,PS,APU,SCU?那就进来看看吧     相信大家刚看到Zynq手册的时候,对着那么一大堆缩略语肯定是一头雾水,特转来一篇文章,为大家解惑 摘要:本文介绍与XILINX的EPP平台成员, ZYNQ芯片相关的缩写术语和含义.  与简单翻译术语不同,本文对每个缩写在本行业其他公司的展开含义也略作介绍, 避免混淆. 对术语的技术功能也作简单介绍. 8月份学校放暑假,  大学计划这边紧急的事不多, 因此通常是俺的充电和学习时间. 本月的学习任务嘛, 当然是ZY…
BackGroud Year 2003不知你是否注意到,四川大学每年都会在各宿舍楼里放老鼠药,以解决学生宿舍的老鼠问题. 今年,学校的领导为了更好的展开灭鼠的行动,引进了一项新的技术:SCU(Super Cat Union). 它是通过两只机器猫对宿舍楼的扫描来判断老鼠的所在,然后采取相应的措施. 这下可惹急了我们的FatMouse,它通过努力,终于找到了SCU的一个bug... The Problem 假设两只猫的工作范围各是一个球,猫位于球中心.在三维空间中两个球的相交点构成一个平面(假设在…
题目链接:http://cstest.scu.edu.cn/soj/problem.action?id=4313 判断是不是存在拆图得到新连通分支的点个数是K的倍数 注意一个点所连的边只能被切一条 #include<stdio.h> #include<string.h> #define N 200001 struct node{ int f,t,fn,tn,nex; }edge[N]; int edgenum, head[N]; void addedge(int u, int v)…
Carries Problem's Link Mean: 给你n个数,让你计算这n个数两两组合相加的和进位的次数. analyse: 脑洞题. 首先要知道:对于两个数的第k位相加会进位的条件是:a%(10^k)+b%(10^k)>=10^k. 想到这一点后就简单了,枚举每一位(最长9位),然后每个数都模10^k,然后排序二分. 排序后,如果b[i]+b[j]>=k,那么i~j-1这段也满足b[i]+b[j]>=k. Time complexity: O(n*logn) view code…
Description One day, Implus gets interested in binary addition and binary carry. He will transfer all decimal digits to binary digits to make the addition. Not as clever as Gauss, to make the addition from a to b, he will add them one by one from a t…
Carries frog has nn integers a1,a2,…,ana1,a2,…,an, and she wants to add them pairwise. Unfortunately, frog is somehow afraid of carries (进位). She defines hardness h(x,y)h(x,y)for adding xx and yy the number of carries involved in the calculation. For…
Censor frog is now a editor to censor so-called sensitive words (敏感词). She has a long text \(p\). Her job is relatively simple -- just to find the first occurence of sensitive word \(w\) and remove it. frog repeats over and over again. Help her do th…