ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1001. Reverse Root

Show all messages Hide all messages

Why I am getting TLE in c++ ? Please help. Muhammad Abdullah 7 Sep 2019 11:05


#include <bits/stdc++.h>
using namespace std;

int main(){
    long long n, res;
    vector <long long> vt;
    while(cin>>n){
        vt.push_back(n);
    }
    int len = vt.size();

    for(int i = len-1; i >= 0; i--){
        double n = sqrt(vt[i]);
        printf("%0.4lf\n", n);
    }

return 0;
}

Edited by author 07.09.2019 11:05

Edited by author 07.09.2019 11:11
Re: Why I am getting TLE in c++ ? Please help. Jamiur Rahman 11 May 2020 14:11
while(cin>>n) .... Its an infinite loop.
My AC solution also used while (cin >> n)
Re: Why I am getting TLE in c++ ? Please help. Nahid Karim Emon 19 Dec 2020 00:18
use EOF for cin
Re: Why I am getting TLE in c++ ? Please help. Pirated_Codes 31 Dec 2022 00:29
double instead of long long while declaring n and vector.