Общий форумAdmins:What is 12th test? Why Timus Online Judge becomes unavailable sometimes? If so happens how are we to know the period? It is easy. I just two array. for point(x,y) change these point: x+dx,y+dy x+dx,y-dy x-dx,y+dy x-dx,y-dy Then you will got AC in 0.031s. ########################################################## dx:array [0..52] of longint=(0,3,4,5,6,7,8,8,9,9,10,12,12,12,12,14,15,15,15,16,16,18,20,20,20,21,21,24,24,24,24,24,27,28,28,30,30,32,33,35,36,36,36,40,40,40,42,44,45,45,48,48,48); dy:array [0..52] of longint=(0,4,3,12,8,24,6,15,12,40,24,5,9,16,35,48,8,20,36,12,30,24,15,21,48,20,28,7,10,18,32,45,36,21,45,16,40,24,44,12,15,27,48,9,30,42,40,33,24,28,14,20,36); ########################################################## Edited by author 29.05.2004 08:52 Fuckie solution.. Just take check all points to can change it on every move. And it's not TLE !!! May be you make unnecessary changes (mod 2 just!!!) When you are reading the data input, take it by modulo 2. My solution with long long got TLE, but after processing ints by modulo 2, everything was ok. easy simple binary search for r... Just a case with the point in target. yes it was very easy to implemet but got almost 0.015 seconds to run... Edited by author 07.07.2005 19:51 Pure math solution is also pretty clear and easy (if you know algebra well). I can't understand, why?! I've tried for many times to change accuracy value and borders of searching (is -10000..10000 enough?), can anybody? please, help me? There is fine mathematical theory about precision for multyple roots(symbolic algebra of polinomials,Gries,...) Acording it to achive precision 10^-6 will enouh to use near 200 digits in all calculations. Thus Java and BigInteger best way to pass tests. Did anybody solve this test without long arithmetics? I found roots of a polynom and then check if they are roots of its derivatives to determine their repeatness, but got WA#14. Is there a better way to calculate roots? My Ac code,but I don't know why? #include<stdio.h> #include <iostream> using namespace std; int main() { unsigned long long int c[25][20],sum; int a,b,n,i,j; for(i=1;i<=20;i++) c[i][1]=i+1; for(i=1;i<=15;i++) c[1][i]=i+1; for(i=2;i<=20;i++) for(j=2;j<=15;j++) c[i][j]=c[i][j-1]+c[i-1][j]; for(i=1;i<=20;i++)c[i][0]=1; scanf("%d%d%d",&n,&a,&b); sum=c[n][a]*c[n][b]; cout<<sum; printf("\n"); return 0; } please tell me:admins,What is WA7? Your programs gives wrong answer on 7th test. But what is the 7yh test.I am working on it till morning.PLease help ,me What is wrong with my programm.in my pc it works correctly. What is wrong with my programm.in my pc it works correctly. When i enter 100 there is error in exe,Why? Why WA#1?I can't understand,my program runs weel in my #include <stdlib.h> #include <iostream> using namespace std; int main() { int n, cnt = 0; register int j; char shop[1001][31]; char used[5] = "stop"; cin >> n; for(register int i = 0; i < n; i++) cin >> shop[i]; for(register int i = 0; i < n; i++) { if(shop[i] == "stop") break; for(j = i + 1; j <= n; j++) { if(strcmp(shop[j], "stop") != 0) if(strcmp(shop[i], shop[j]) == 0) { cnt++; strcpy(shop[j], "stop"); } } } cout << cnt; } The same problem: #include <stdio.h> #include <string.h> void main(void) { char n[1000][31]={'/'}; int i,y,qw,bayan=0; scanf("%d",&qw); for(i=0;i<qw;i++) { scanf("%s",&n[i][0]); for(y=0;y<=i-1;y++) if(strcmp(n[y],n[i])==0) { n[y][0]='/'; bayan++;} } printf("%d",bayan); } Edited by author 20.01.2010 11:12 Edited by author 20.01.2010 11:12 "The brands are the strings of Latin letters and blanks"! scanf doesn't read blanks ("aaa bbb" - two words for scanf). I use getline(cin,str); // !!! for(int i=0; i<n;i++){getline(cin,str)... and Accepted. a[n+1]-a[n]=a[1]-a[0]+2*(c[1]+c[2]+...+c[n]); code: #include<stdio.h> #define N 3000 float c[N+5]; int main() { int i,k,m; float sum,a0,an,t; scanf("%d",&m); scanf("%f%f",&a0,&an); for(i=1;i<=m;i++) scanf("%f",&c[i]); sum=0; k=m; for(i=1;i<=m;i++) { sum=sum+k*c[i]; k--; } sum=sum*2; t=(an+m*a0-sum)/(m+1); printf("%.2f",t); return 0; } Edited by author 14.05.2010 19:53 Hi! I solved the problem with binary search and got TL. After the search for some test I have found that the actual solution includes use of binary tree. So, what the difference? I actually thought that search is better because it doesn't use any memory, isn't it? example: input int A: 12345678910111212 int B: 12345678910111212 output: Add is: 24691357820222424 Minus is: 0 Multi: 1.5241578775156476338589020810894..... div is: 1 You have full code (write by C) share with my Thanks a lots Example: text: abc abc accabcb acc pattenr: acc Position: 8 Position: 16 code full used Boyer-More Algorithms and Knuth-moris-part Algorithms ( written by C ) Thanks You are not allowed to swap digits in the last number (the sum of N numbers) Example ------- Input: 2 11 20 13 Output: Unrecoverable error. Where is Greenpeace? Oh,rebits,rebits... Test: 2 1 2 3 4 My Ac program gives YES 1 0 2 0 I dont know if other solutions will fail on this test, but.. =) Crash (access violation) Try to test with zero-length sequences (containing no one interval) In 24 test precision greater than 18? why? Always format input is dd.mm.yyyy dd.mm.yyyy dd.mm.yyyy dd.mm.yyyy dd.mm.yyyy dd.mm.yyyy or may be (for example) 2 dd.mm.yyyy dd.mm.yyyy dd.mm.yyyy dd.mm.yyyy dd.mm.yyyy dd.mm.yyyy ? Edited by author 09.05.2010 02:02 Format is dd.mm.yyyy dd.mm.yyyy dd.mm.yyyy dd.mm.yyyy dd.mm.yyyy dd.mm.yyyy ,.'A'..'Z'a'..'z in this test my program gave "2" and got WA4, but now I got AC, because the correct answer is "1". why answer "1"?????? , . // . ' A // Ok ' . // . . // . ' Z // Ok ' a // ok ' . // . . // . ' z // mistake thank you very much!!!This test has helped me to receive AC!!!=)) |
|