| Show all threads Hide all threads Show all messages Hide all messages |
| could you help me,I don't know what's the matter?problem set 1001 | gigliolily | 1001. Reverse Root | 29 Oct 2011 16:49 | 3 |
problem set 1001 #include<stdio.h> #include<math.h> void main() {long a,b,c,d; scanf("%lf%lf%lf%lf",&a,&b,&c,&d); printf("%6.4f%5.4f%13.4f%8.4f",sqrt(d),sqrt(c),sqrt(b),sqrt(a)); } I know it's wrong ,but I don't know which type to use to define the figure that is very big Edited by author 29.10.2011 16:35 Edited by author 29.10.2011 16:35 there may be more than 4 numbers as input and your solution is right only for cases with 4 numbers P.S. read the statements more carefully Edited by author 29.10.2011 16:48 but it only gives four figures.thanks for help. |
| Ответ | Ivan_cheretaev | 1889. Airport Announcements | 29 Oct 2011 16:22 | 1 |
Ответ Ivan_cheretaev 29 Oct 2011 16:22 скинте ответ если не жалко плиз... |
| No subject | Rashid Gaziyev | 1885. Passenger Comfort | 29 Oct 2011 15:52 | 1 |
Edited by author 04.11.2011 19:17 |
| seconds | fenvik92 | 1885. Passenger Comfort | 29 Oct 2011 15:32 | 3 |
Can "t" be equal to 63.2. Or we must write 64.0 Re: seconds ...†.†.†... Stigius ...†.†.†... 29 Oct 2011 15:29 |
| speed | MSUSB3 | 1885. Passenger Comfort | 29 Oct 2011 15:30 | 2 |
speed MSUSB3 29 Oct 2011 15:25 can speed be real or equal to 0? Edited by author 29.10.2011 15:26 Edited by author 29.10.2011 15:26 Re: speed ...†.†.†... Stigius ...†.†.†... 29 Oct 2011 15:30 |
| Rejudge | ...†.†.†... Stigius ...†.†.†... | 1892. Morning in Koltsovo | 29 Oct 2011 15:21 | 1 |
Rejudge ...†.†.†... Stigius ...†.†.†... 29 Oct 2011 15:21 Tests 2-7 were invalid, so they are removed now. All solutions were rejudged. |
| what's wrong with this...? | gigliolily | | 29 Oct 2011 15:13 | 3 |
problem set 1000 I don't know what's the matter,i learn c and it could run in vc6.0,why is it wrong ? #include<stdio.h> void main() {int a,b; scanf("%d%d",&a,&b); printf("a+b=%d",a+b); } Your program outputs a+b=6 instead of just 6 thank you,I don't think it will matter at first,now I know it's so important. |
| What is precision? | Rashid Gaziyev | 1885. Passenger Comfort | 29 Oct 2011 15:00 | 5 |
how many digits after decimal point should we print? Read the problem statement Not greater than 6 decimals isn't it? |
| second test | Aybek | 1889. Airport Announcements | 29 Oct 2011 14:56 | 2 |
hi to everybody! i don't understand the second test! i think that igor could hear english phrase two times and french phrase too! unknown = french! am i right? can anyone help? No two languages can only go consecutive. :) |
| test 3 | nightwolf212 | 1889. Airport Announcements | 29 Oct 2011 14:15 | 2 |
test 3 nightwolf212 29 Oct 2011 14:13 Why in 3 test answer 1? Igor should hear 3 phrases on different language Edited by author 29.10.2011 14:18 Edited by author 29.10.2011 14:18 Re: test 2 ...†.†.†... Stigius ...†.†.†... 29 Oct 2011 14:15 |
| solved | Tom | 1005. Stone Pile | 29 Oct 2011 14:13 | 4 |
Edited by author 05.08.2011 19:30 thank you. i meant that i solved my problem this post was about actually Re: solved Anupam Ghosh, Wipro Technologies 29 Oct 2011 14:13 |
| mistake in the statement? | exod40 | 1888. Pilot Work Experience | 29 Oct 2011 13:59 | 2 |
In the second line output n integers I think it should be "p integers" |
| How java deal with these input? | bidakung | 1001. Reverse Root | 29 Oct 2011 02:08 | 5 |
When i using BufferedReader of java with readLine function. It will read for 'N' lines that 'N' is specific. And when input is not specific of line, how should i deal with the input? How java knows the input string is ended? Sorry for bad english, bidakung my idea: BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); .......... try{ while(true){ .....in.readLine()....... } } catch(Exception e){} ........... the end of read by Exception. Edited by author 23.04.2011 17:40 you can not catch exceptions - this is a bug You can use StringTokenizer by reading the line as string and then dividing it into tokens. Scanner inputReader = new Scanner(System.in);
while(inputReader.hasNext()) { long n = inputReader.nextLong();
}
Edited by author 29.10.2011 02:14 Edited by author 29.10.2011 02:19 |
| Getting error | Rahat khan | 1068. Sum | 29 Oct 2011 01:42 | 2 |
first i tried: for input -3 : 1+0-1-2-3 = -5 for input 3 : 1+2+3 = 5 got an Error !! What's the Idea ??? 1+2+3 = 5 is wrong the answer correct is 6 |
| Why I get wa?Many tests I have passed?help!!! | gbaoxing | 1348. Goat in the Garden 2 | 28 Oct 2011 14:40 | 1 |
#include <cstdio> #include <cstring> #include <cmath> #include <iostream> struct node { int x,y; }A,B,C; double length(int x1,int y1,int x2,int y2) { double x=x1-x2; double y=y1-y2; return sqrt(x*x+y*y); } int Abs(int x) { return x>0?x:-x; } int main() { int l,min,max; double l1,l2,m1,m2; m2=-9999999; scanf("%d%d%d%d%d%d%d",&A.x,&A.y,&B.x,&B.y,&C.x,&C.y,&l); double s1; s1=length(A.x,A.y,C.x,C.y); if(s1>m2) m2=s1; s1=length(B.x,B.y,C.x,C.y); if(s1>m2) m2=s1; m2-=l; if(A.x-B.x==0) { min=A.y>B.y?B.y:A.y; max=A.y>B.y?A.y:B.y; if(C.y>=min&&C.y<=max) { m1=Abs(C.x-A.x); m1-=l; } else { l1=length(A.x,A.y,C.x,C.y); l2=length(B.x,B.y,C.x,C.y); m1=l1>l2?l2:l1; m1-=l; } } else { int k1,b1,k2,b2; k1=(A.y-B.y)/(A.x-B.x); if(k1==0) { min=A.x>B.x?B.x:A.x; max=A.x>B.x?A.x:B.x; if(C.x>=min&&C.x<=max) { m1=Abs(C.y-A.y); m1-=l; } else { l1=length(A.x,A.y,C.x,C.y); l2=length(B.x,B.y,C.x,C.y); m1=l1>l2?l2:l1; m1-=l; } } else { min=A.y>B.y?B.y:A.y; max=A.y>B.y?A.y:B.y; k2=-(1/k1); b1=A.y-k1*A.x; b2=C.y-k2*C.x; int x,y; x=(b2-b1)/(k1-k2); y=k1*x+b1; //printf("%lf %lf\n",x,y); if(y>=min&&y<=max) { m1=length(C.x,C.y,x,y); m1-=l; } else { l1=length(A.x,A.y,C.x,C.y); l2=length(B.x,B.y,C.x,C.y); m2=l1>l2?l2:l1; m2-=l; } } } printf("%.2lf\n%.2lf\n",m1>0?m1:0,m2>0?m2:0); return 0; } 2 1 4 2 0 0 1 -5 0 5 0 0 5 100 1 1 1 1 10 10 100 -2 6 2 6 0 0 0 -1 1 1 1 -4 -3 0 1 2 1 1 0 0 0 1 1 1 1 0 0 0 All these test I have passed > |
| 2nd Test | Arthur Tadevosyan | 1804. The Machinegunners in a Playoff | 28 Oct 2011 01:56 | 1 |
2nd Test Arthur Tadevosyan 28 Oct 2011 01:56 I don't understand where the error |
| Thank you! | Gleb Grenkin | 1024. Permutations | 28 Oct 2011 00:27 | 7 |
Thank you! In this forum I knew how solve this task! We must find lengths of pathes for every element of permutation and count their LCM. Don't forget about Int64 in Pascal and long long in C++. Here is my AC solution: [code deleted] Edited by author 15.08.2005 07:46 Edited by moderator 04.12.2019 20:48 Edited by author 17.02.2008 09:53 thanks a lot!! i can't find correct algo till today!! i think that this code must be deleted This code give TLE on test 9, how did you have AC? You don't need long long or int64. Also, please delete your code, posting correct solution is against the rules! Edited by author 28.10.2011 00:27 |
| LCM and long long | Alexander J. Villalba G. | 1024. Permutations | 28 Oct 2011 00:23 | 5 |
the solution is achieved using LCM (MCM in Spanish) and long long to express the result > long long to express result Correct! Overflow can happen otherwise. Edited by author 17.07.2011 03:09 Edited by author 17.07.2011 03:09 The final answer fits int type. BUT when you multiply two ints, you must convert the product to long long. After that you divide the product and the answer doesn't exceed int range :) NO! You don't need long long! Instead of: a * b / gcd(a,b) Use this: a / gcd(a,b) * b This way you won't get overflow. |
| To Admins | Siroj Matchanov [TUIT] | 1871. Seismic Waves | 27 Oct 2011 21:16 | 1 |
To Admins Siroj Matchanov [TUIT] 27 Oct 2011 21:16 Admins, lease add a "graph theory" tag for this problem. |
| why the sample's answer is 28? i think it's 26 | Edric Mao | 1267. Yekaterinburg Subway | 27 Oct 2011 20:43 | 1 |
|