|
|
back to boardtime limit. i am begginer. what i do wrong? #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 |
|
|