結果

問題 No.1700 floor X
ユーザー vjudge1
提出日時 2025-07-06 10:52:55
言語 C++17(gcc12)
(gcc 12.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 445 bytes
コンパイル時間 8,644 ms
コンパイル使用メモリ 207,356 KB
実行使用メモリ 7,848 KB
最終ジャッジ日時 2025-07-06 10:53:09
合計ジャッジ時間 12,332 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 1
other WA * 44
権限があれば一括ダウンロードができます
コンパイルメッセージ
In file included from /home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.4.0/include/c++/12/istream:39,
                 from /home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.4.0/include/c++/12/sstream:38,
                 from /home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.4.0/include/c++/12/complex:45,
                 from /home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.4.0/include/c++/12/ccomplex:39,
                 from /home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.4.0/include/c++/12/x86_64-pc-linux-gnu/bits/stdc++.h:54,
                 from main.cpp:1:
In member function 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long long int) [with _CharT = char; _Traits = std::char_traits<char>]',
    inlined from 'void run()' at main.cpp:19:17:
/home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.4.0/include/c++/12/ostream:202:25: warning: 'tam' may be used uninitialized [-Wmaybe-uninitialized]
  202 |       { return _M_insert(__n); }
      |                ~~~~~~~~~^~~~~
main.cpp: In function 'void run()':
main.cpp:11:26: note: 'tam' was declared here
   11 |         ll l = 1, r = x, tam;
      |                          ^~~

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll n, x;
void inp(){
    cin >> n;
}
void run(){
    while(n--){
        cin >> x;
        ll l = 1, r = x, tam;
        while(l <= r){
            ll mis = (l + r) / 2;
            if(mis * mis <= x){
                tam = mis;
                l = mis + 1;
            }else r = mis - 1;
        }
        cout << tam;
    }
}
int main(){
    inp();
    run();
    return 0;
}
0