Common BoardShow all threads Hide all threads Show all messages Hide all messages | why the state still in "Waiting" for a long long time... | roberthuang | 1209. 1, 10, 100, 1000... | 27 May 2015 20:14 | 6 | just like subject... You can read previous subjects and find answer... Edited by author 26.05.2015 11:36 Edited by author 26.05.2015 11:36which one?can you tell me,thanks Alexander Klepinin said: "We are still experiencing technical problems. Recovery time is unknown for now. Sorry for inconveniense." Please, be patient. The machine which provides checking service has failed. That's why solutions can be submitted and processed by the system but then you see them in the 'Waiting' state (no checking is available right now). We expect recovery by the end of this week (or even earlier, if everything goes well). | When will results? | Felix_Mate | | 27 May 2015 12:20 | 2 | Что с сайтом? Решения сдаю уже 2-3 дня. Please, be patient. The machine which provides checking service has failed. That's why solutions can be submitted and processed by the system but then you see them in the 'Waiting' state (no checking is available right now). We expect recovery by the end of this week (or even earlier, if everything goes well). | Help what is wrong? C++ | Misha | 1001. Reverse Root | 26 May 2015 19:15 | 5 | This is my code. #include <iostream> #include <cmath> #include <iomanip> using namespace std; int main() { long double a; cin >> a; cout << fixed << setprecision(4) << sqrt(a) << endl; return 0; } In my opinion the problem is that the user should be able to insert a set of numbers, while in your code you can only give 1 value in input. as i known you can insert the code "main()" on the line of "return 0;" the wrong is your data type try to store the double side alone and the integar alone and then calculate them into output :D like long long int_side = sqrt(a); double float_side = sqrt(a)-int_side; cout << int_side+float_side ; You also have to print result in reverse order. Square root of number you read last should be displayed first. Edited by author 26.05.2015 19:16 Edited by author 26.05.2015 19:16 | I don't get it. | Artem Berezovsky | 1345. HTML | 25 May 2015 18:50 | 1 | What is test 2? I can't think of anymore tests, it's really killing me. Here is my code, if you can see a mistake, please tell me. #include<stdio.h> #include<string.h> #include<iostream> #include<cctype> #include<memory.h> char keywords[35][64] = {{'a','n','d'},{'a','r','r','a','y'},{'b','e','g','i','n'},{'c','a','s','e'},{'c','l','a','s','s'},{'c','o','n','s','t'},{'d','i','v'},{'d','o'},{'e','l','s','e'},{'e','n','d'},{'f','o','r'},{'f','u','n','c','t','i','o','n'},{'i','f'},{'i','m','p','l','e','m','e','n','t','a','t','i','o','n'},{'i','n','t','e','r','f','a','c','e'},{'m','o','d'},{'n','o','t'},{'o','f'},{'o','r'},{'p','r','o','c','e','d','u','r','e'},{'p','r','o','g','r','a','m'},{'r','e','c','o','r','d'},{'r','e','p','e','a','t'},{'s','h','l'},{'s','h','r'},{'s','t','r','i','n','g'},{'t','h','e','n'},{'t','o'},{'t','y','p','e'},{'u','n','i','t'},{'u','n','t','i','l'},{'u','s','e','s'},{'v','a','r'},{'w','i','t','h'},{'w','h','i','l','e'}}; char s[1024][256]; bool IsKeyword(char y[256]) { int j = 0; bool itis = false; for(int i = 0; i<35; i++) { if(tolower(y[0]) == keywords[i][0] && strlen(y) == strlen(keywords[i])) { for(j = 1; j<strlen(y); j++) { itis = false; if(tolower(y[j]) != keywords[i][j]) break; itis = true; } } if(itis && !((s[i][j+1] >='a' && s[i][j+1]<='z') || (s[i][j+1] >='A' && s[i][j+1] <='Z'))) {memset(y,0,sizeof(y));return true;} } memset(y,0,sizeof(y)); return false; } int main() { int x,y; int strings = 0; int skip = 0; int i = 0; bool was; while(gets(s[i++])!=0) strings++; for(int i = 0;i<strings; i++) { int j = 0; was = false; if(strlen(s[i]) == 0) {printf("\n");continue;} for(j; j<strlen(s[i]);j++) { if(s[i][j]>='0' && s[i][j]<='9' && (s[i][j-1] == '=' || s[i][j-1] == ' ' || j == 0)) { printf("<span class=number>"); int numdots = 0; while((s[i][j] >='0' && s[i][j] <='9') || (s[i][j] == '.' && numdots < 2 && (s[i][j+1] >='0' && s[i][j+1] <='9'))) { printf("%c", s[i][j]); j++; if(s[i][j] == '.') numdots++; } j--; if(j == strlen(s[i])) {if(s[i][j] == '.') printf("</span>.\n"); else printf("</span>.\n"); continue;} else {if(s[i][j] == '.') printf("</span>."); else printf("</span>"); continue;} j--; continue; } if((s[i][j] >='a' && s[i][j]<='z') || (s[i][j] >='A' && s[i][j] <='Z')) { char insert[64]; int len = 0; for(int k = j; k<strlen(s[i]); k++) { if((s[i][k] >='a' && s[i][k]<='z') || (s[i][k] >='A' && s[i][k] <='Z')) { memset(insert,0,sizeof(insert)); len = 0; while((s[i][k] >='a' && s[i][k]<='z') || (s[i][k] >='A' && s[i][k] <='Z') || (s[i][k]>='0' && s[i][k]<='9')) {insert[len++] = s[i][k];k++;} if(IsKeyword(insert)) { printf("<span class=keyword>"); for(j; j<k; j++) printf("%c", s[i][j]); if(len == strlen(s[i])) printf("</span>"); else printf("</span>"); break; } //else //{ // for(j;j<=k;j++) // printf("%c", s[i][j]); //} } else break; } } if(s[i][j] == '{' || (s[i][j] == '/' && s[i][j+1] == '/')) { if((s[i][j] == '{' && skip == 0)) { j++; printf("<span class=comment>{"); for(int k = j; k<strlen(s[i]); k++) { j = k; if(s[i][k] == '{') skip++; if(s[i][k] == '}') { if(skip == 0) {printf("}</span>");j++;break;} else {skip--;} } printf("%c", s[i][k]); if(k == strlen(s[i])-1) {i++; k = -1;printf("\n");} } } else { printf("<span class=comment>"); for(j;j<strlen(s[i]);j++) printf("%c", s[i][j]); j = strlen(s[i]); printf("</span>");}
} if(s[i][j] == '\'' || s[i][j] == '#') { if(s[i][j] == '\'') { j++; printf("<span class=string>\'"); int len; while(s[i][j] !='\'') { len = j; printf("%c", s[i][j]); if(j == strlen(s[i])-1) {i++; j = 0; printf("\n"); continue;} j++; } printf("\'</span>"); continue; } else if(s[i][j+1] >= '0' && s[i][j+1] <='9') { printf("<span class=string>#"); j++; int len; for(int k = j; (s[i][k] >='0' && s[i][k]<='9'); k++) {len = j; printf("%c", s[i][j]);j++;} printf("</span>"); j--; continue; } } if((j!=strlen(s[i]) || j!=strlen(s[i])) && was == false) printf("%c", s[i][j]); if((j >= strlen(s[i])-1))//i != strings-1) {printf("\n");} } } //for(int i = 0;;i++); } | We have a technical issue, judging will not run until Monday | Vladimir Yakovlev (USU) | | 24 May 2015 17:06 | 1 | | 1068 | omyrbai | 1068. Sum | 24 May 2015 15:38 | 2 | 1068 omyrbai 22 May 2015 23:12 here is my code. pls help me to figure out the mistake i have made?! program asdl; var i,n : integer; k : int64; begin readln(n); k := 0; if n > 1 then for i := 1 to n do k := k + i; if n = 0 then k := 1; if n <= 0 then begin for i := 1 to -n do k := k + i; k := -k + 1; end; write(k); end. Hi. Try to change n > 1 to n > 0 and n <= 0 to n < 0 Edited by author 24.05.2015 15:42 | I think that it seems to be dp problem) | Alibi | 1210. Kind Spirits | 23 May 2015 07:34 | 2 | | A possible test data. | kiko | 1040. Airline Company | 22 May 2015 17:17 | 2 | 4 4 1 2 2 3 3 1 1 4
One possible answer is: YES 1 2 3 4 Thank you a lot, this problem took me so much time | Runtime error (non-zero exit code) Test 5 | ipchi | 2046. The First Day at School | 20 May 2015 22:10 | 1 | Assalamu 'alekum! Who can explain me that "Runtime error (non-zero exit code)" Admin can you give test 5? | WA#12 | Dewang Sultania | 1494. Monobilliards | 19 May 2015 18:03 | 1 | WA#12 Dewang Sultania 19 May 2015 18:03 Can someone tell what test case 12 is?? | Why wrong answer | tyrone_tgdriver | 1001. Reverse Root | 18 May 2015 23:41 | 1 | #include<iostream> #include<cmath> #define MAX 32768 //input stream 256KB #define SWAP( a,b ) { a=a^b; b=a^b; a=a^b; } using namespace std; void printSqrt( char * ); int isSpace( int ); void reverseString( char * ); void findSqrt( char *, char * ); int main() { // Reads the input char input_stream[MAX]; for( int i=0; i<MAX; i++) { std::cin.get( input_stream[i] ); if( std::cin.eof() ) break; } // Find square root for all integers printSqrt( input_stream ); return 0; } void printSqrt( char *inp ) { // reverse the string reverseString( inp ); // get each string char *start=inp; char *end=inp; for(;*inp!='\0';inp++) { if(isSpace(*inp)) { findSqrt( start, end ); start=inp+1; end=inp+1; } else { end=inp; } } findSqrt( start, end ); } void findSqrt( char *start, char *end ) { if(isSpace(*start) || *start=='\0') return;
int strln = (end-start+1); char *p = new char[strln*sizeof(char)]; int i; for(i=0;i<strln;i++) *(p+i)=*(start+i); *(p+i)='\0'; reverseString( p ); // convert char array to number unsigned long long num=0; for(int j=0;*(p+j)!='\0';j++) { num*=10; num+=*(p+j)-'0'; } std::cout.precision(4); std::cout << std::fixed << sqrt(num) << std::endl; delete p; } int isSpace( int c ) { switch ( c ) { case ' ': case '\n': case '\t': case '\v': case '\f': case '\r': return 1; } return 0; } void reverseString( char *strg ) { int i = 0; while( *(strg+i) != '\0' ) i++; i--; for( int j=0,k=i; j<k; j++,k-- ) SWAP( *(strg+j), *(strg+k) ); } | This problem is harder than the rating he has | scythe | 1091. Tmutarakan Exams | 18 May 2015 00:47 | 2 | some hints: use pascal triangle to generate c(n,k) if you use 63 bits data type all will fit. prime factorize each number for each prime count the number of number where he is a factor calculate number of posibilites remove duplicates ( this is what makes this problem a little bit harder ). Good luck. remove duplicates ( this is what makes this problem a little bit harder ). If you don't know how to do this part take a look at derivation of Euler's totient function. | it shows runtime error....can't find the problem....plz help me judges.. | Shariar Kabir (Himel) | 1209. 1, 10, 100, 1000... | 17 May 2015 18:19 | 3 | n=int(input()) s='' a='' for i in range(100): s=s+str(10**i) for j in range(n): x=int(input()) a=a+s[x-1]+' ' print(a) Edited by author 09.05.2015 00:38 Edited by author 09.05.2015 00:39 Edited by author 09.05.2015 00:39 same problem...............try........try........try | Why is C++11 so slow on Timus? | Al.Cash | | 16 May 2015 18:38 | 1 | I bet I'm not the first one asking, but this question isn't in FAQ. Why does the same code compiled under G++ 4.9 C++11 works about 2-3 times slower than under Visual C++ 2010? Doesn't make sense to me. Also enforces to keep all the templates old style, which is very bad. Edited by author 17.05.2015 17:38 | test#4(access violation) | LNCP | 1069. Prufer Code | 16 May 2015 05:25 | 2 | HELP!My algo:find the minimum,add the edge,sort and print,the first and the third step I use the heap.I don't think these matter. My code: #include<iostream> using namespace std; const int maxn = 7500; int heap_size = 0, now = 0; int heap[maxn + 1]; struct edge { int neighbour; edge *pre; }e[maxn + 1]; edge *tail[maxn + 1]; inline void swap(int i, int j) { int temp; temp = heap[i]; heap[i] = heap[j]; heap[j] = temp; return; } void heap_up(int i) { if (i == 1) return; int father = i / 2; if (heap[i] < heap[father]) { swap(i, father); heap_up(father); } return; } void heap_down(int i) { int left = i * 2; int right = left + 1; int least = i; if (left <= heap_size && heap[left] < heap[least]) least = left; if (right <= heap_size && heap[right] < heap[least]) least = right; if (least != i) { swap(i, least); heap_down(least); } return; } inline void heap_delete(int i) { swap(i, heap_size--); heap_down(i); return; } inline void heap_insert(int key) { heap[++heap_size] = key; heap_up(heap_size); return; } inline void connect(int u, int v) { e[++now].neighbour = v; e[now].pre = tail[u]; tail[u] = e + now; return; } int main() { int son[maxn + 1] = { 0 }, code[maxn]; int n = 1, i, u, v, temp; do { temp = 0; cin >> temp; if (temp) { code[n++] = temp; son[temp]++; } } while (temp); for (i = 1; i <= n; i++) if (!son[i]) heap_insert(i); for (i = 1; i <= n; i++) tail[i] = nullptr; for (i = 1; i < n; i++) { v = heap[1]; heap_delete(1); u = code[i]; if (!(--son[u])) heap_insert(u); connect(u, v); connect(v, u); } edge *p; heap_size = 0; for (i = 1; i <= n; i++) { cout << i << ":"; for (p = tail[i]; p != nullptr; p = p->pre) heap_insert(p->neighbour); for (; heap_size; heap_delete(1)) cout << " " << heap[1]; cout << endl; } return 0; } Edited by author 06.02.2015 21:40 Edited by author 07.02.2015 08:44 Somewhere there should be bad indexing. Try to increase arrays size from maxn + 1 to maxn + 50 and check what results judge gives. | If you have TLE in java | Cebotari Vladislav | 1658. Sum of Digits | 15 May 2015 21:40 | 1 | Instead of doing a lot of System.out.print, write all chars in a StringBuilder, and then print the StringBuilder once in the end. | 1000 what's the problem? | dds861 | 1000. A+B Problem | 15 May 2015 01:45 | 2 | #include <iostream> int main() { int a=1+5; std::cout<<a; } Input numbers are not always 1 and 5, they are given to your stdin. | Bugurt thread | Evgeny Shulgin | 1133. Fibonacci Sequence | 15 May 2015 01:44 | 2 | I killed a lot of time writing the solution in C++, Python, Java. Java gives AC with BigInteger -_- It is NOT solvable with int64 It is not solvable BY YOU with int64 | What answer? | OpenGL | 1265. Mirror | 14 May 2015 00:58 | 3 | What answer on this test? 0 3 1 1 1 0 3 0 Edited by author 04.01.2009 19:53 On C++ with double I got WA 9, on Pascal with extended - WA 4, but on Pascal with double - WA 11. Why??? Edited by author 04.01.2009 19:55 | I can not format output Wrong Answer | Konstantine Babuadze | 1001. Reverse Root | 13 May 2015 20:18 | 2 | #include <iostream> #include <stdio.h> #include <iomanip> #include <math.h> using namespace std; void main() { int n=0; int i=1,j; double number; float a[140000];
while (cin) {
cin>>number; a[i] = sqrt(number); n+=1; i++;
} for (j = n-1; j>=1; j--) { printf("%f \n",a[j]); } system("pause"); } Edited by author 13.05.2015 15:57 ive done it ! Its impossible to do this with arrays.. should use vectors |
|
|