| Show all threads Hide all threads Show all messages Hide all messages |
| vaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa | My name is KHON | | 13 Jan 2012 19:50 | 1 |
hiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii |
| The N is too large to use an array... Do you have any ideas? | Moya | 1465. Pawn Game | 13 Jan 2012 18:16 | 5 |
I'll give you two hints: 1) You must be familiar with nimbers. 2) Look for a cycle. I used another program to find a cycle when generating nimbers up to let's say 10 000. Good luck ;) can you tell me what the cycle is? thanks. The sequence of answers is periodic(period length=34). But it becomes periodic from a certain position. can you send your AC code to me?please to this e-mail: mwhaea123456@163.com Thank you so much |
| WA#3 | Nick | 1313. Some Words about Sport | 13 Jan 2012 17:20 | 1 |
WA#3 Nick 13 Jan 2012 17:20 #include "iostream" using namespace std; int main() { int n; cin>>n; int ar[101][101]; for(int i=0;i<n;i++) for(int j=0;j<n;j++) cin>>ar[i][j]; cout<<ar[0][0]<<' '; for(int i=1;i<n;i++) { int b=0; for(int j=i;j>=0;j--) { cout<<ar[j][b]<<' '; b++; } } for(int i=1;i<4;i++) { int b=n-1; for(int j=i;j<n;j++) { cout<<ar[b][j]<<' '; b--; } } return 0; } Help me! |
| Why can not AC? | zj_zcy | 1023. Buttons | 13 Jan 2012 14:06 | 5 |
var n,i,j:longint; begin readln(n); if (n<=2)then begin writeln('0') ; halt; end; j:=trunc(sqrt(n)); for i:=3 to j do begin if (n mod i=0) then break; end; writeln(i-1); end. Can anybody tell me why? It seems rigth^Why ? It drives me crazy^ Edited by author 15.06.2008 14:10 Edited by author 15.06.2008 14:10 I think your j should be n div 2,and I promise it's not TLE.And you can define 'ans' to store the answer and let it equal n.That's all. zj_zcy, what if n = 3 ? Your program wrote 0, but right answer 2 The trouble is if n is big prime. Try this: 99999989 The answer is: 99999988. Think how to modify algorithm to catch big primes in factorization. Here it isn't necessary, but it will be useful. Your code will possibly fail for integers like 2*n,also for test cases where n is a prime number |
| Can be this case? a=b<c=d<e=f. | Hrayr | 1142. Relations | 13 Jan 2012 03:42 | 3 |
Apply the GOOD JOB for College ACMers to Make Large Money and Become a Millionaire Hello, We need large no. of dedicated and hard working ACMers. The payment is good so we need ACMers to be efficient. All you have to do to get the job is to sign up at our websites. The link of our websites are given below. http://www.PaisaLive.com/register.asp?3556638-4847933 After the registration, a confirmation email will be sent to your specified email address. Please click on the link inside the confirmation email to activate your account and recieve ACM work instantly. For any other queries you can mail the administrator. Miss Juliet Admin paisalive.com Yes, you can have this case. Your hint has helped my solve the problem. KEYWORDS: Stirling numbers of 2nd kind, Factorial |
| What input in test 3? | Ananas | 1496. Spammer | 12 Jan 2012 22:03 | 1 |
0 Edited by author 12.01.2012 22:05 |
| Visual Basic | Christiaan | | 12 Jan 2012 21:39 | 1 |
Does any one know if 2008 will also work? or must you use 2010? |
| It's nice problem | Qodirov Nodir [ Tashkent U of IT ] | 1260. Nudnik Photographer | 12 Jan 2012 21:07 | 2 |
1 1 2 4 6 9 14 21 31 46 68 100 147 216 317 465 682 1000 1466 2149 3150 4617 6767 9918 14536 21304 31223 45760 67065 98289 144050 211116 309406 453457 664574 973981 1427439 2092014 3065996 4493436 6585451 9651448 14144885 20730337 30381786 44526672 65257010 95638797 140165470 205422481 301061279 441226750 646649232 947710512 |
| Test for WA9 | Игорь | 1592. Chinese Watches | 12 Jan 2012 20:46 | 2 |
5 12:00:00 12:00:00 12:00:00 12:00:00 1:00:00 |
| I spent too much time on this problem. But still WA #28. Help me!! | Try_to_try | 1793. Tray 2 | 12 Jan 2012 19:18 | 2 |
Can anyone tell me my mistake. Here is my code. Thanks #include <iostream> #include <sstream> #include <string> #include <vector> #include <deque> #include <queue> #include <set> #include <map> #include <algorithm> #include <functional> #include <utility> #include <cmath> #include <cstdlib> #include <ctime> #include <cstdio> #include <cstring> //#include <conio.h> using namespace std; #define oo 1000000000 #define fi first #define se second #define sqr(a) ((a)*(a)) #define FR(i,n) for (int i = 0; i < (n); i++) #define DN(i,a) for(int i = (a)-1; i >= 0; i--) #define FOR(i,a,b) for (int i = (a); i <= (b); i++) #define DOWN(i,a,b) for(int i = (a); i >= (b); i--) #define FORV(i,a) for(typeof(a.begin()) i = a.begin(); i != a.end(); i++) typedef pair<int, int> PII; typedef vector<int> VI; double kc(double x1, double y1, double x2, double y2) { return sqrt(sqr(x1 - x2) + sqr(y1 - y2)); } int main () { double a, b, d, r11, r12, r21, r22, h; cin >> a >> b >> d; cin >> r11 >> r12 >> r21 >> r22 >> h; if (2 * max(r21, r11) > min(a, b)) { cout << "NO" << endl; return 0; } double x1 = r11, y1 = r11; double x2 = a - r21, y2 = b - r21; if (kc(x1, y1, x2, y2) < r11 + r21) { cout << "NO" << endl; return 0; } if (d >= h) { if (2 * max(r12, r22) > min(a, b)) { cout << "NO" << endl; return 0; } double x1 = r12, y1 = r12; double x2 = a - r22, y2 = b - r22; if (kc(x1, y1, x2, y2) < r12 + r22) { cout << "NO" << endl; return 0; } } if (d < h) { double r1m = d * (r12 - r11) / h + r11; double r2m = d * (r22 - r21) / h + r21; if (2 * max(r1m, r2m) > min(a, b)) { cout << "NO" << endl; return 0; } double x1 = r1m, y1 = r1m; double x2 = a - r2m, y2 = b - r2m; if (kc(x1, y1, x2, y2) < r1m + r2m) { cout << "NO" << endl; return 0; } } cout << "YES" << endl; return 0; } You're using sqrt which loses precision. you should use int64. |
| why wrong? | Phoenix264 | 1005. Stone Pile | 12 Jan 2012 18:40 | 1 |
#include <stdio.h> #include <math.h> int a[20]; int count; int main() { scanf("%d", &count); for(int i = 0; i < count; i++) { scanf("%d", &a[i]); }
// Сортировка пузырьком bool t = true; while(t) { t = false; for(int i = 0; i < count-1; i++) { if(a[i] > a[i+1]) { int tmp = a[i]; a[i] = a[i+1]; a[i+1] = tmp; t = true; } } }
int r1 = a[count - 1], r2 = 0; for(int i = count - 2; i >= 0; i--) { if(r1 > r2) r2 += a[i]; else r1 += a[i]; } if(r2 > r1) r1 = r2 - r1; else r1 = r1 - r2; printf("%d\n", r1); return 0; } |
| Oybek na gap | SoSimple | 1111. Squares | 12 Jan 2012 18:17 | 7 |
Edited by author 28.10.2007 14:24 Ishlayapti musobaqa boshlanganiga 20 min bo'ldi kirib ko'r Sani kurmin duribman Aniq bilaman dostupni olib tashladingmi yo bunday bo`lishi mumkin emas sen meni ko`rayapsan men esa yoq yana bir marta tekshirib ko`r Edited by author 28.10.2007 14:26 Edited by author 28.10.2007 14:43 Dostub bargan papkanga kir shunda go'rasan ishlab durganini Iltimos Timusni chat qivormela endi .... |
| Why WA1? | Ignat Zakrevsky | 1299. Psylonians | 12 Jan 2012 14:14 | 1 |
Why WA1? Ignat Zakrevsky 12 Jan 2012 14:14 I always have WA1? Give me some tests My code is here: ====================================== #include <iostream> #include <math.h> using namespace std; void Attack(int &, int &, int &, int &); void Guard(int &, int &); void Defense(int &); void Patrol(int &, int &); void OffensiveStrike(int &, int &); void RetreatStrike(int &, int &); void LEFT(int &); void RIGHT(int &); void FRONT(int &); void BACKWARD(int &); void FIRE(int &); void STOP(); int X,P; int M,MP,MA; int main() { cin >> X >> P;
char model; cin >> model;
cin >> M >> MP >> MA;
if ('A'==model) { int N,NP; cin >> N >> NP; Attack(N,NP,M,MP); } else if ('G'==model) Guard(M,MA); else if ('D'==model) Defense(M); else if ('P'==model) { int A; cin >> A; Patrol(M,A); }
} void Attack(int &N, int &NP, int &M, int &MP) { if (N*NP>M*MP*3) OffensiveStrike(M,MA); else RetreatStrike(M,MA); } void Guard(int &M, int &MA) { if (0==M) STOP; else if (MA>=5) LEFT(X); else if (MA<=-5) RIGHT(P); else FIRE(P); } void Defense(int &M) { if (M*20>=P) RetreatStrike(M,MA); else Guard(M,MA); } void Patrol(int &M, int &A) { if (M>0) Defense(M); else if (abs(A)<=20 || 180-abs(A)<=20) { if (abs(A)<=20) FRONT(X); else BACKWARD(X); } else if ((A>=90 && A<160) || (A>=-90 && A<-20)) RIGHT(X); else LEFT(X);
}
void OffensiveStrike(int &M, int &MA) { if (abs(MA)>=10 || 0==M) FRONT(X); else FIRE(P); } void RetreatStrike(int &M, int &MA) { if (abs(MA)>=5 || 0==M) BACKWARD(X); else FIRE(P); } void LEFT(int &X) { if (X>100) cout << "LEFT 100"; else cout << "LEFT " << X; } void RIGHT(int &X) { if (X>100) cout << "RIGHT 100"; else cout << "RIGHT " << X; } void FRONT(int &X) { if (X>100) cout << "FRONT 100"; else cout << "FRONT " << X; } void BACKWARD(int &X) { if (X>100) cout << "BACKWARD 100"; else cout << "BACKWARD " << X; } void FIRE(int &P) { if (P>20) cout << "FIRE 20"; else cout << "FIRE " << P; } void STOP() { cout << "STOP"; } |
| Ask for solution ,better with code | mwh | 1001. Reverse Root | 12 Jan 2012 12:56 | 1 |
|
| if you have wa 23 try this | Olya Chistokova | 1772. Ski-Trails for Robots | 12 Jan 2012 10:41 | 1 |
6 2 3 4 5 2 3 4 5 answer is 1 |
| time limit. i am begginer. what i do wrong? | primumnah@gmail.com | 1086. Cryptography | 12 Jan 2012 10:27 | 1 |
#include <iostream> //1086 acm.timus.ru bool table [170000]; int user [15001]; long n = 170000; int num = 0; int main() { std::cin>>num; for (int i = 0; i < num; i++) { std::cin>>user[i]; } for (long i =1; i < 2*n+1; i++) { for (long j = 1; i >= j&&i+j+2*i*j < n; j++) { table[i+j+2*i*j] = 1; } } table[0] = 1; table[1] = 0; for (int i = 0, a = 1, j = 0; user[j] > 0; i++) { if (user[j] == 1) { std::cout<<2<<std::endl; j++; i = 0; a = 1; } if ( !(table[i]) ) a++; if (a == user[j]) { std::cout<<i*2+1<<std::endl; j++; i = 0; a = 1; } } return 0; } Edited by author 16.01.2012 23:47 |
| Wrong answer Java | gaaral | 1001. Reverse Root | 12 Jan 2012 08:36 | 6 |
My code: BS)))) Isn't it because in (1) round answer? Could you help me? Edited by author 12.01.2012 00:24 The same with this code: import java.io.BufferedReader; import java.io.InputStreamReader; public class ReSqrt {
public static void main(String[] args) {
String st = null, st1 = "";
try{ BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
while ((st = br.readLine()) != null){ st1 = st1 + st; } }catch (Exception e){ e.printStackTrace(); }
st1 = st1.trim(); st1 = st1.replaceAll("\\s{1,}", "\u0020"); String[] arrSt = st1.split(" "); int sizeArr = arrSt.length;
float outSqrt;
for (int i = sizeArr - 1; i>=0; i--){ outSqrt = Float.parseFloat(arrSt[i]); outSqrt = (float)Math.sqrt(outSqrt); System.out.printf("%.4f", outSqrt); System.out.println(); } } } NEVER use float, use double instead thx I did, and I got "Memory limit exceeded")) new code:
String st = null, st1 = "";
try{ BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
while ((st = br.readLine()) != null){ st1 = st1 + st+" "; } }catch (Exception e){ e.printStackTrace(); }
st1 = st1.trim(); st1 = st1.replaceAll("\\s{1,}", "\u0020"); String[] arrSt = st1.split(" "); int sizeArr = arrSt.length;
double outSqrt, dSt;
for (int i = sizeArr - 1; i>=0; i--){ dSt = Long.parseLong(arrSt[i]); outSqrt = Math.sqrt(dSt); System.out.printf("%.4f", outSqrt); System.out.println();
} String concatenation is slow Regexps are slow ALWAYS use code below to read input data BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); PrintWriter out = new PrintWriter(System.out); StringTokenizer tok = null; String readString() throws IOException { while (tok == null || !tok.hasMoreTokens()) { tok = new StringTokenizer(in.readLine()); } return tok.nextToken(); } int readInt() throws IOException { return Integer.parseInt(readString()); } double readDouble() throws IOException { return Double.parseDouble(readString()); } Even if it has \r\n??? Got it!!! Edited by author 12.01.2012 09:25 |
| Is it possible ? | Todor Tsonkov | 1013. K-based Numbers. Version 3 | 12 Jan 2012 01:38 | 7 |
I don't think it's possible. In FAQ it's written that minimal memory is over 100k because of compilator.Even only 2 variables need more than 2 k.And time is impossible to :) I really can't understand the reason. And 'vongang ' please respect others.Use English. |
| To admins | Aleksandr Konovalov | 1772. Ski-Trails for Robots | 11 Jan 2012 01:10 | 2 |
To admins Aleksandr Konovalov 10 Jan 2012 22:37 Hello! I found the following interesting test: n 1 n 1 1 2 2 3 3 ... n-1 n-1 1 n-1 where n is a large number (such as 100000) The result is n-1 |
| I've got ACCCC!!!See my code!!didn't use const. | a | 1086. Cryptography | 10 Jan 2012 22:39 | 5 |
0.17sec,86k; var prost:array[1..16000] of longint; i,j,k,x,n:longint;flag:boolean; procedure look(x:longint); var i:longint; begin i:=prost[k]; repeat i:=i+2; flag:=true; for j:=1 to k do begin if i mod prost[j]=0 then begin flag:=false; break; end; if prost[j]*prost[j]>i then break;{This is very important} end; if flag then begin k:=k+1; prost[k]:=i; end; until k=x; writeln(prost[k]); end; begin prost[1]:=2; prost[2]:=3; prost[3]:=5; k:=3; read(n); for i:=1 to n do begin read(x); if x>k then look(x) else writeln(prost[x]); end; end. my solution works in 0.031, but 273 kb without const... first of all I calc all the numbers and then only write necessary numbers Sorry for my English:) Edited by author 11.03.2009 15:41 my time is 0.031 memory 182kb; mister 'a' in your algo you use i:=i+2; you can check only 6*i-1 or 6*i+1 integers;prime number can't be any other type:)) sorry for my English :) |