|
|
вернуться в форумhere is fast working algo.... please tell me anybody .. why does my compiler works good, but it says compilation error #include<iostream> #include<sstream> #include<cmath> using namespace std; int main() { int size; cin>>size; long int *x = new long int [size]; int i, max = 0; for(i = 0;i< size;i++){ cin>>x[i]; if(x[i] > max){ max = x[i]; } } long int a = 1, c; int b = 1, d = 0; int answer; stringstream ss; while(b <= max){ ss << a; c = a; // b += log10(a); a = a * 10; } string s; s = ss.str(); ss.clear(); for(i = 0; i < size; i++){
cout << s[x[i]-1] << ' '; } //cout << '\n' << s << '\n';
s.clear(); delete [] x; return 0; } |
|
|