Common BoardIs it right, that on even numbers answer will always "No"? n=k*(k+1)/2+1 in this position consist 1 else 0 Я ничего не понял Shunmadim Misunderstanding I can't understand how you use N in your solution. N is only number of elements and nothing more. Maybe, I understand you wrong. if 8k-7 is a squre then a[i]=1 else a[i]=0 Can I ask how could you find that? So beautiful solution The thing is that the sequence of positions of '1' in 1101001000... can be represented as (N*(N-1)/2+1). You can find this out by yourself or turn to http://oeis.org/classic/ So let's try to check whether an input A is a position of '1'. N*(N-1)/2 + 1 = A; N^2 - N + 2 - 2*A = 0; N is natural, so solution is: N = 1/2 * (1 + sqrt(8*A - 7)); So, A is a position if sqrt(8*A-7) is natural. k=sqrt((n-1)*2+0.0); if (n*(n+1)==(n-1)*2) cout<<1<<" "; else cout<<0<<" "; #include <iostream> #include <cmath> #include <iomanip> #include <stdio.h> using namespace std; int main() {
int i; float A[256*1024/4];
for( i=0; i<65536; i++) //scanf("d%",A[i]); A[i]=0+rand()%256;
for(i=65536; i>=0; i--) { if ( A[i]>=0 && A[i]<= pow(float(10),18) ) { std::cout.precision(4); std::cout<<fixed<<sqrt(A[i]); } else return 0;
}
return 0; } use array size 256*1024/2 = 131072 "for( i=0; i<65536; i++)" is wrong. because they can also input only 2 integers as input. Hello! How do we know how many integers will be they entering as input? Because generally hitting "ENTER" indicates "end of input" but here any number of "Enter (New Line)" can be used between two Inputs.
They can input anything like this: --------------------------------------- 144 625 25 81 100 10000 3877935 --------------------------------------- how will we our program (code) know " this is an end of input "? I mean till when should we use "scanf" in program? thanks Edited by author 19.10.2011 02:45 Edited by author 20.10.2011 15:29 find --> nd first --> rst final --> nal finite --> nite Please correct it. how name type this problem, type, where you should create 1-2 formuli and choise minimal or maximal value in one of it? We live in the one flat with Linford. I showed him that site, so he wanted to do some exams. But I wanted him not to cheat, but he is downloading solution for every exam. Can you ban him? I have no idea ... If somebody've got AC, send some tests, pls Got AC 0.015 with this magic code #define forn(i,n) for (int i = 0; i < (int)(n); i++) typedef long double ld; ld g = 9.81l; int main() { ld l, h, w; cin >> l >> h >> w; l /= 100, h /= 100, w *= acosl(0) / 15; ld t = 0; forn (i, 1000) { ld d = fabsl(sinl(w * t) * l / 2); //g x^2 /2 + (x-t)wl/2 + d = h //x^2 g/2 + x wl/2 - wlt/2+d-h = 0 t = (-w * l / 2 + sqrtl(w * w * l * l / 4 + 2 * g * (w * l * t / 2 - d + h))) / g; } cout << ((cosl(w * t) > 0) ? "butter": "bread"); } the next moment found the normal solution. Edited by author 19.10.2011 12:17 For test 34 I have time limit exceeded answer. I have done the problem in Java. May I see the test 34? Thanks. I solved by using int[] instead of ArrayList. for 100 2 1 1 1 1 ..{98 times total}.. 1 1 1 0 ? Edited by author 15.10.2011 17:09 mine 67 32 Any more results? Why does the answer on this test contain only two numbers? I think there should be 100 numbers Edited by author 15.10.2011 18:04 Edited by author 15.10.2011 18:05 other is 0, mine: 51 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 I have 50 0 0 0..{99 times}..0 0 0 Is it right? I have 50 0 0 0..{99 times}..0 0 0 Is it right? No. Answer equal 51 0 0 ... {99 times} 0 Answer: 2-100/101=102/101 98*(1-100/101)=98/101 98/101+102/101=200/101 (102/101):(200/101)=(102/101)*(101/200)=102/200 (102/200)*100=102/2=51 PS: But memoring in computer in type double 51 as 51.00000000001 or 50.999999999999999. Because you got 50, when answer 51. Wrong accuracy you got. Don't used double. Used only int, or should add epsilon (0 < epsilon < 1e-12) what test #5? Please I crash #5 WA 5 =( I don't know where the mistake can be... don't use SHORT use INT or CHAR instead. I got crash on this test and it helps me to get AC. P.S.: Sorry for my English :) when i tryed to submit my program with variable type long long and input/output through iostream, i've got wa10. but when i changed variable types to double and replace iostream with stdio, i've got ac. both programs gives same answers to all my tests. where is my mistake? Из условия следует, что ТОЛЬКО к меньшему числу спереди дописаны нули. Но это неправда(тест 2). Please, help with test 8!.. Don't know what do( I have a problem in test 8. Could someone give me a hint? :( be careful about taking radius double........ best of luck.... may I ask why? because in the description it says: "and a real number R".Uusually "real number" refers to numbers that could have a fractional part, not only integers. Consider best precision in calculation. Who can help me. '«' and '»' means? If I get a string from "William",does it is "RT @William: ..."? This means the length of my string = 6 + length of nick + length of William's string? I'm from China. I couldn't access twitter because of GFW,the Great Fire Wall. Thank you. Sorry for my poor English. This means the length of my string = 6 + length of nick + length of William's string? ------------------------------------------------------------------ Yes, you're right! That's mean length = length of message + length of nick + 6... |
|