E-COM-NET
首页
在线工具
Layui镜像站
SUI文档
联系我们
推荐频道
Java
PHP
C++
C
C#
Python
Ruby
go语言
Scala
Servlet
Vue
MySQL
NoSQL
Redis
CSS
Oracle
SQL Server
DB2
HBase
Http
HTML5
Spring
Ajax
Jquery
JavaScript
Json
XML
NodeJs
mybatis
Hibernate
算法
设计模式
shell
数据结构
大数据
JS
消息中间件
正则表达式
Tomcat
SQL
Nginx
Shiro
Maven
Linux
PAT甲级1072
PAT甲级
1011
#includeintmain(){doublew,t,l;doublemax=1,temp=0.0;chars[1000];intnum=0,i=0;while(scanf("%lf%lf%lf",&w,&t,&l)!=EOF)//inti=3;//题目只说输入三次,不过无所谓了//while(i--){//(scanf("%lf%lf%lf",&w,&t,&l)!=EOF);temp=w;s[
平凡之路漫漫
·
2020-08-09 10:12
PAT甲级
PAT甲级
1018 Public Bike Management
1018PublicBikeManagement(30分)思路:DFS遍历求出所有可能的最短路径,对于每条可能的最短路径求其send和take_back,比较选择最优的;注意点:不可以从后经过的城市中取自行车给前面的城市;看别的博客说可以用Dijkstra算法修改一下做DFS,我jio着效率可能会高点,等有时间了我去研究研究!#includeusingnamespacestd;structway{
qq_33231894
·
2020-08-09 10:03
PAT甲级刷题历程
PAT甲级
1011
1011WorldCupBetting(20分)这个吧,比较简单所以也没采坑,就是觉得还挺迷的这个profit的计算方法;#includeusingnamespacestd;intmain(){vector>game(3,vector(3,0));for(inti=0;i>game[i][j];}vectorans;floattmp=1;for(inti=0;imax(game[i][1],gam
qq_33231894
·
2020-08-09 10:03
PAT甲级刷题历程
PAT甲级
1020 Tree Traversals
1020TreeTraversals(25分)思路:层序遍历的变形,用队列存储左右子树,只不过这个左右子树是根据后序和中序推导得到的;#includeusingnamespacestd;vectorlevel;voidtolevel(vectorpost,vectorin){queue>ps,is;vectortmp;tmp.push_back(0);tmp.push_back(post.size
qq_33231894
·
2020-08-09 10:03
PAT甲级刷题历程
PAT甲级
1017 Queueing at Bank
1017QueueingatBank(25分)测试点5:要注意只要顾客是在17点之前进入银行,那么即使他等待到了17点之后,他依然将被服务,依然需要计算等待时间思路和前面有一题的排队问题很像,模拟整个过程;#includeusingnamespacestd;structrecord{inthour,min,sec,protime;inttime;intendtime;};boolcmp(recor
qq_33231894
·
2020-08-09 10:03
PAT甲级刷题历程
PAT甲级
1009 测试点0
1009ProductofPolynomials(25分)测试点0:系数项可能为负数,所以有些项的系数会为零,此时不应输出#includeusingnamespacestd;intmain(){intn;cin>>n;mapa;for(inti=0;i>tmp1>>tmp2;a[tmp1]=tmp2;}cin>>n;mapb;for(inti=0;i>tmp1>>tmp2;b[tmp1]=tmp2
qq_33231894
·
2020-08-09 10:03
PAT甲级刷题历程
PAT甲级
1019
1019GeneralPalindromicNumber(20分)emm一次就过了所以也没看出来测试点。。。大概需要注意的就是当N为0时直接输出Yes吧思路:比较直接,首先进行进制的转换,转换后的数字判断是否是对称的即可#includeusingnamespacestd;vectortobase(intn,intb){vectornum;if(n==0){num.push_back(0);retu
qq_33231894
·
2020-08-09 10:03
PAT甲级刷题历程
PAT甲级
1014 测试点4、5
1014WaitinginLine(30分)直接模拟整个过程就好啦,没啥弯弯绕绕的;测试点4、5:顾客只要是在17:00前开始服务的都可以被服务完,所以判断条件里还要加上这一条;及代码中注释部分#includeusingnamespacestd;structman{intid,ServTime;intETime;};intmain(){intn,m,k,q;cin>>n>>m>>k>>q;vect
qq_33231894
·
2020-08-09 10:03
PAT甲级刷题历程
PAT甲级
1026 Table Tennis
1026TableTennis(30分)测试点测试点1,2:没有VIP球桌空闲时,VIP球员正常排队;测试点4:球员打球时间超过两小时的,都按照两小时计算;测试点5,7:VIP球员在普通球桌和VIP球桌同时空闲时,会优先选择编号较小的VIP球桌;测试点8:球员等待时间从秒转换为分钟时按照四舍五入计算;球桌的编号为1~N;思路:和前面的银行排队题一样,进行简单的模拟,不过我写的好长呀=。=模拟的过程
qq_33231894
·
2020-08-09 10:03
PAT甲级刷题历程
PAT甲级
真题(二分)——1010 Radix (25 分)
1010Radix(25分)Givenapairofpositiveintegers,forexample,6and110,canthisequation6=110betrue?Theansweris“yes”,if6isadecimalnumberand110isabinarynumber.NowforanypairofpositiveintegersN1andN2,yourtaskistofi
逃课去学习:)
·
2020-08-09 10:57
PAT
c++
算法学习
二分
PAT甲级
1001 A+B Format 20分
题目简介Calculatea+bandoutputthesuminstandardformat–thatis,thedigitsmustbeseparatedintogroupsofthreebycommas(unlesstherearelessthanfourdigits).输入信息Eachinputfilecontainsonetestcase.Eachcasecontainsapairofi
离域小派键
·
2020-08-09 10:58
PAT甲级
算法
java
c++
PAT甲级
1010 (进制和二分法)
题目Givenapairofpositiveintegers,forexample,6and110,canthisequation6=110betrue?Theansweris“yes”,if6isadecimalnumberand110isabinarynumber.NowforanypairofpositiveintegersN1andN2,yourtaskistofindtheradixof
我家面试官最好看
·
2020-08-09 10:50
刷子刷题
PAT甲级
1010
1010.Radix(25)时间限制400ms内存限制65536kB代码长度限制16000B判题程序Standard作者CHEN,YueGivenapairofpositiveintegers,forexample,6and110,canthisequation6=110betrue?Theansweris"yes",if6isadecimalnumberand110isabinarynumber
strivinging
·
2020-08-09 10:08
PAT
C++
C++程序设计
程序设计
PAT甲级
1010.Radix(25) 题目翻译与答案
题目来源自PAT网站https://www.patest.cn/题目描述:1010.Radix(25)ivenapairofpositiveintegers,forexample,6and110,canthisequation6=110betrue?Theansweris"yes",if6isadecimalnumberand110isabinarynumber.Nowforanypairofpo
漂流瓶jz
·
2020-08-09 10:02
PAT甲级
PAT甲级
1011.World Cup Betting(20) 题目翻译与答案
题目来源自PAT网站https://www.patest.cn/题目描述:1011.WorldCupBetting(20)Withthe2010FIFAWorldCuprunning,footballfanstheworldoverwerebecomingincreasinglyexcitedasthebestplayersfromthebestteamsdoingbattlesfortheWor
漂流瓶jz
·
2020-08-09 10:02
PAT甲级
PAT甲级
1009 Product of Polynomials(C++实现)
PAT甲级
1009ProductofPolynomials(C++实现)Thistime,youaresupposedtofindA×BwhereAandBaretwopolynomials.InputSpecification
皓空Fly
·
2020-08-09 09:36
C++
PAT
PAT 甲级 1009 Product of Polynomials (25 分)
题目:
PAT甲级
1009ProductofPolynomials(25分)经验总结:使用unordered_map来存储第一行的项。在输入第二行多项式时,计算并用map来存储最终结果。
资深小透明
·
2020-08-09 09:06
PAT
甲级
Radix (25)-
PAT甲级
1010.Radix(25)Givenapairofpositiveintegers,forexample,6and110,canthisequation6=110betrue?Theansweris“yes”,if6isadecimalnumberand110isabinarynumber.NowforanypairofpositiveintegersN1andN2,yourtaskistofi
柳婼
·
2020-08-09 09:46
PAT
PAT甲级
1010. Radix (25)
Givenapairofpositiveintegers,forexample,6and110,canthisequation6=110betrue?Theansweris“yes”,if6isadecimalnumberand110isabinarynumber.NowforanypairofpositiveintegersN1andN2,yourtaskistofindtheradixofon
liaotl10
·
2020-08-09 09:17
PAT甲级
PAT甲级
1010TMD的坑
##TMLGB一切皆有可能内容:简介:故事要从博主今天中午睡了个午觉说起,博主醒了浑身乏力只能祭出一道PAT题来找回精神,从此踏上一条不归路。。。废话不多说,祭题。题目大概意思:N1,N2为输入的两个非负整数redix为第tag数的进制数,让我们求最小的redix2使得N1=N2,比如例子6110110的答案为2:十进制下的6等于二进制下的110。先说一下笔者遇到的坑,首先是二分查找。假设N1进制
knswd
·
2020-08-09 09:35
PAT甲级
_1009(Product of Polynomials)
1009多项式乘积这次,你应该求出多项式A和B的乘积(A*B)输入规范每个输入文件包含一个测试用例。每个测试用例占行,每行包含一个多项式的信息:KN1aN1N2aN2…NKaNK其中K表示多项式中非零项的个数,Ni和aNi(i=1,2,3,…,K)分别表示指数和系数。它们的范围位1#includeusingnamespacestd;constintMAXN=1005;pairp[MAXN];//保
i_meteor_shower
·
2020-08-09 08:43
PAT甲级
PAT甲级
1010【Radix】二分搜索
之前想暴力过的结果第7个测试点过不去。。其实我一直没想明白最大进制为啥可以大于36,明明表示的时候是到z(35)。。一直WA。。后来看了其他大神的题解才知道用二分做。left=n2中的最大值+1。right=n1的十进制值+1。由于java的各种慢,以下代码也只能在Pat最快的那台评测机(据姥姥说是1/6的概率)下AC。。TAT补充:2018.8.9更新,博主二刷这题同样是暴力WA在第7个点。。。
gq97
·
2020-08-09 08:39
二分
pat甲级
1010
本题几个注意点1、注意进制上限是n2+12、用二分法不然会超时3、统一转换为十进制再比较但可能会溢出(一开始用的进制方法有一个测试点过不去不知为何)#include#include#include#includeusingnamespacestd;//俩种求十进制的方法结果不同?longconverse(stringn,longradix){longi,result=0;for(i=0;i='0'
大庭小藏
·
2020-08-09 07:42
PAT甲级
1010Radix25分/二分法猜进制转换/详细解读精准求出上限下限
题目来源:https://pintia.cn/problem-sets/994805342720868352/problems/994805507225665536代码参考:https://www.liuchuo.net/archives/2458题目大意翻译:已知r进制的数n1,求n2在什么进制能等于n1解法分析:假如已经能想到先将n1换成十进制数,然后就该测试n2的进制了难点:1.目标进制的下
浒鱼鱼
·
2020-08-09 07:15
PAT甲级
pat甲级
1010. Radix (25)
1010.Radix(25)时间限制400ms内存限制65536kB代码长度限制16000B判题程序Standard作者CHEN,YueGivenapairofpositiveintegers,forexample,6and110,canthisequation6=110betrue?Theansweris"yes",if6isadecimalnumberand110isabinarynumber
active2489595970
·
2020-08-09 06:53
pat甲级解题报告
PAT甲级
—— World Cup Betting
Withthe2010FIFAWorldCuprunning,footballfanstheworldoverwerebecomingincreasinglyexcitedasthebestplayersfromthebestteamsdoingbattlesfortheWorldCuptrophyinSouthAfrica.Similarly,footballbettingfanswereput
Xiao2018428
·
2020-08-09 06:27
PAT
PAT甲级
1010,1011解题报告
1010Radix(25分)Givenapairofpositiveintegers,forexample,6and110,canthisequation6=110betrue?Theanswerisyes,if6isadecimalnumberand110isabinarynumber.NowforanypairofpositiveintegersN1andN2,yourtaskistofind
Tate_Brown
·
2020-08-09 06:27
C++
PAT
C
PAT甲级
真题1009. Product of Polynomials
题目链接:https://www.patest.cn/contests/pat-a-practise/1009题意:给我们两个多项式每一项的系数以及指数,让我们求出这两个多项式的乘积。题目中给出的指数范围为0~1000,那么显然乘积的指数范围为0~2000,那么我们可以直接用2000大小的数组存储每一位的系数,在乘法完成后我们再将不等于0的位数找出来即可。这里需要注意的是,比较系数是否等于0的方法
RaAlGhul
·
2020-08-09 06:47
ACM_Water
PAT考题练习题解
PAT甲级
1010:Radix
Givenapairofpositiveintegers,forexample,6and110,canthisequation6=110betrue?Theansweris“yes”,if6isadecimalnumberand110isabinarynumber.NowforanypairofpositiveintegersN1andN2,yourtaskistofindtheradixofon
Nick12138_2017
·
2020-08-09 06:01
1
PAT甲级
-1010. Radix (25)进制
1010.Radix(25)时间限制400ms内存限制65536kB代码长度限制16000B判题程序Standard作者CHEN,YueGivenapairofpositiveintegers,forexample,6and110,canthisequation6=110betrue?Theansweris"yes",if6isadecimalnumberand110isabinarynumber
kewlgrl
·
2020-08-09 06:33
C4
top
/
PAT
PAT甲级
1009. Product of Polynomials (25)
1009.ProductofPolynomials(25)时间限制400ms内存限制65536kB代码长度限制16000B判题程序Standard作者CHEN,YueThistime,youaresupposedtofindA*BwhereAandBaretwopolynomials.InputSpecification:Eachinputfilecontainsonetestcase.Eachc
Sitlos
·
2020-08-09 05:42
PAT甲级
pat甲级
1010 Radix (二分查找)
做题+看代码2h...debug半小时#include#include#include#include#includeusingnamespacestd;longlongconvert(stringn,longlongradix){longlong_n=0;inttemp=0,index=0;for(autoc=n.rbegin();c!=n.rend();c++){temp=isdigit(*c
Alternative_19
·
2020-08-09 05:11
pat甲级
PAT甲级
1011 World Cup Betting (20 分)
直接选大小#include#defineFIfirst#defineSEsecondusingnamespacestd;typedeflonglongll;constllmaxn=1e8+7;doublea1,a2,a3;doubleb1,b2,b3;doublec1,c2,c3;doubleans;voidsolve(doublea,doubleb,doublec){if(a>=b&&a>=c)
冰冰的小宝贝
·
2020-08-09 05:27
PAT甲级
PAT甲级
A1009 Product of Polynomials
PAT甲级
A1009ProductofPolynomials题目:Thistime,youaresupposedtofindA×BwhereAandBaretwopolynomials.InputSpecification
遇见更好的自己.jpg
·
2020-08-09 05:44
PAT甲级题解
【python】
PAT甲级
1010 Radix (24/25分)
题目Givenapairofpositiveintegers,forexample,6and110,canthisequation6=110betrue?Theanswerisyes,if6isadecimalnumberand110isabinarynumber.NowforanypairofpositiveintegersN1andN2,yourtaskistofindtheradixofon
汪汪碎冰冰
·
2020-08-09 05:43
PAT
【python】
PAT甲级
1011 World Cup Betting (20/20分)
题目Withthe2010FIFAWorldCuprunning,footballfanstheworldoverwerebecomingincreasinglyexcitedasthebestplayersfromthebestteamsdoingbattlesfortheWorldCuptrophyinSouthAfrica.Similarly,footballbettingfanswerep
汪汪碎冰冰
·
2020-08-09 05:43
PAT
PAT甲级
1011 World Cup Betting (20分)
1011WorldCupBetting(20分)题目链接:PATA1011思路分析:嗯…这道题就很迷,我不知道它那个公式是怎么来的,开始还以为是按照题意,不同的数据对应不同的公式,后来才发现所有数据都是那个公式,但是我不太理解(原谅笨笨的我,大家有明白的别忘了告诉我啊~),但是不影响做题。就是找每行中赔率最大的输出它所对应的的字母,然后用那个公式计算收益就可以了。AC代码:#includeusin
sosalt8
·
2020-08-09 05:38
PAT甲级题解
PAT甲级
1009 Product of Polynomials第一个测试点不通过
注意事项第一个测试点一直不过,后来把cnt计数放在外面就通过了。。。我这边的建议就是不要在计算乘积的时候计数,另外在循环一次计数原始代码#include#include#includeusingnamespacestd;structpolynomial{intexponent;doublecoefficient;};intmain(){intcnt=0,numa,numb;doubleresult
哦啦哦啦!
·
2020-08-09 05:02
PAT甲级
PAT甲级
1010radix
第一次题解(20分)#include#include#includeusingnamespacestd;typedeflonglongLL;stringN1,N2;intradix,tag;LLtemp[256];LLinf=(1LLt)return-1;}returnans;}LLfind_left(stringn){intlen=n.size();intans=-1;for(inti=0;ia
菜鸟的飞行日记
·
2020-08-09 05:00
pat甲级
PAT甲级
1011 World Cup Betting
PAT甲级
1011WorldCupBettingWiththe2010FIFAWorldCuprunning,footballfanstheworldoverwerebecomingincreasinglyexcitedasthebestplayersfromthebestteamsdoingbattlesfortheWorldCuptrophyinSouthAfrica.Similarly
旺 崽
·
2020-08-09 05:33
PAT甲级
排序
vector
PAT甲级
1009 Product of Polynomials
PAT甲级
1009ProductofPolynomialsThistime,youaresupposedtofindA×BwhereAandBaretwopolynomials.InputSpecification
旺 崽
·
2020-08-09 05:33
PAT甲级
模拟
PAT甲级
1011 World Cup Betting (20 分) 题解
\quad这个题难在题意理解上面,说白了就是给你九个数,三个一组,找出一组中最大的数字并记录下这个数所属类别(W,T,L)。一行是一组。最后把每个组最大的数乘起来,乘0.65,再减去1,最后将所得结果乘2输出。即(max1∗max2∗max3∗0.65−1)∗2(max_1*max_2*max_3*0.65-1)*2(max1∗max2∗max3∗0.65−1)∗2。#include#includ
程勇uestc
·
2020-08-09 05:20
PAT甲级
PAT甲级
1009 Product of Polynomials (25 分) 题解
\quad模拟多项式乘法,很简单,程序如下:#includeusingnamespacestd;intmain(){floatcoef[2001]={0},a[1001]={0},b[1001]={0};intnum1,num2;intexp;floattemp;scanf("%d",&num1);for(inti=0;i=0;--i){if(coef[i]!=0.0)printf("%d%.1f
程勇uestc
·
2020-08-09 05:20
PAT甲级
PAT甲级
1010 测试点
1010Radix(25分)测试点0:n1,n1n_1,n_1n1,n1相同;测试点7:二分法上界赢设置为已知数据+1,而不是已知数据测试点3,45,9,11:数据会超出intintint型范围,改成longlonglong\longlonglong即可测试点8,10,12,13,15,16:longlonglong\longlonglong同样会溢出,需要加上溢出判断,舍去即可#includeu
qq_33231894
·
2020-08-09 05:39
PAT甲级刷题历程
PAT (Advanced Level) Practice 1010 Radix
PAT甲级
最低通过率,果然名不虚传
RadixPATAdvancedLevel上面通过率最低的一题了。果然有很多坑分析:看到题目中0~z,很容易想象是36进制,然而实际上进制上不封顶,我们只有搜索,而一般的搜索会超时改为二分搜索这道题用int肯定不行的某些情况用longlongint还是会溢出,变成负数,这里要追加判断思路:题目给定了一个确定的数,先把它转换成10进制二分搜索,确认左边界右边界,左边界为另一个人串的最大数字+1(小于
hhmy77
·
2020-08-09 04:32
PAT
(Advanced
Level)
Practice
PAT题解
PAT甲级
1010 Radix (25 分)
题目:戳这里题意:输入四个数N1N2tagradix,其中tag为1表示N1的基数为radix,tag为2表示N2的基数为radix。求另一个数的基数,使得N1==N2。解题思路:这题用暴力试过了,超时,所以改成二分基数。不得不说一个正确的二分对我来说还是比较难写的,这题扣二分边界和一些坑,花了两个小时才满分。代码中注释的有我个人认为的坑点和我自己测试用的样例。#include#include#i
euzmin
·
2020-08-09 04:18
PAT甲级
PAT甲级
1012 The Best Rank
重复代码很多的一道模拟题,感觉写得不够好。坑点就是,可能会忘记分数相等时,排名是并列的,取高。至于课程的优先级问题,把高优先级的课程放在低优先级之后排序即可,如果排名相等,高优先级会覆盖掉低优先级。然后,最后针对m个id,输出最高排名。如果用线性扫描,复杂度O(nm),也不会超时。可以考虑对id排序,然后二分,我就懒得写了。#includeusingnamespacestd;constintmax
坤斤拷
·
2020-08-09 04:41
PAT甲级题解
PAT甲级
1010 Radix
思路很简单,把两个数分别转为10进制,然后进行比较。主要有几个坑:radix可能会很大(在题目中没有说明),要用longlong(经测试,能装下tag指定的数)要用二分搜索答案,否则会超时二分的初始上下界为tag指定的数值+1+1(一个+1是因为左闭右开,另一个是因为可能会有a10210这样的样例)和另一个数的最大位数+1(显然)若二分时mid过大,可能会导致结果为负数,要将这个可能加入判断中#i
坤斤拷
·
2020-08-09 04:41
PAT甲级题解
PAT甲级
1011 World Cup Betting
模拟题。#includeusingnamespacestd;constdoubleEPS=1e-6;charc[3]={'W','T','L'};charbuy[3];doubleans=0.65;voidread(){for(inti=0;iEPS){maxo=odd;buy[i]=c[j];}}ans*=maxo;}}voidsolve(){for(inti=0;i<3;++i){printf
坤斤拷
·
2020-08-09 04:41
PAT甲级题解
PAT甲级
1009 Product of Polynomials
O(n2)暴力模拟。两个多项式相乘,也就1e6,可以水过。当然,也可以选择写个链表,麻烦了些。#includeusingnamespacestd;constintmaxn=1e3+1;constintmaxm=2e3+2;constdoubleEPS=1e-6;intk;doublet[maxn];doubleans[maxm];intmain(){intn;doublea;scanf("%d",
坤斤拷
·
2020-08-09 04:40
PAT甲级题解
上一页
12
13
14
15
16
17
18
19
下一页
按字母分类:
A
B
C
D
E
F
G
H
I
J
K
L
M
N
O
P
Q
R
S
T
U
V
W
X
Y
Z
其他