結果

問題 No.1700 floor X
ユーザー vjudge1
提出日時 2025-07-06 10:55:05
言語 C++17(gcc12)
(gcc 12.3.0 + boost 1.87.0)
結果
AC  
実行時間 32 ms / 2,000 ms
コード長 453 bytes
コンパイル時間 4,992 ms
コンパイル使用メモリ 208,084 KB
実行使用メモリ 7,844 KB
最終ジャッジ日時 2025-07-06 10:55:18
合計ジャッジ時間 8,065 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 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 <= x / mis){
                tam = mis;
                l = mis + 1;
            }else r = mis - 1;
        }
        cout << tam << endl;
    }
}
int main(){
    inp();
    run();
    return 0;
}
0