結果

問題 No.1132 凸凹
ユーザー kpinkcatkpinkcat
提出日時 2023-08-27 00:47:46
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 716 bytes
コンパイル時間 1,021 ms
コンパイル使用メモリ 103,012 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-08-27 00:47:50
合計ジャッジ時間 2,682 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 1 ms
4,376 KB
testcase_07 AC 1 ms
4,380 KB
testcase_08 AC 2 ms
4,376 KB
testcase_09 AC 1 ms
4,380 KB
testcase_10 AC 2 ms
4,376 KB
testcase_11 AC 2 ms
4,376 KB
testcase_12 AC 1 ms
4,376 KB
testcase_13 AC 2 ms
4,376 KB
testcase_14 AC 2 ms
4,376 KB
testcase_15 AC 1 ms
4,376 KB
testcase_16 AC 1 ms
4,376 KB
testcase_17 AC 2 ms
4,376 KB
testcase_18 AC 1 ms
4,380 KB
testcase_19 AC 2 ms
4,376 KB
testcase_20 AC 1 ms
4,376 KB
testcase_21 AC 2 ms
4,380 KB
testcase_22 AC 1 ms
4,380 KB
testcase_23 AC 1 ms
4,384 KB
testcase_24 AC 1 ms
4,380 KB
testcase_25 AC 1 ms
4,380 KB
testcase_26 AC 2 ms
4,376 KB
testcase_27 AC 1 ms
4,380 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
次のファイルから読み込み:  /usr/local/gcc7/include/c++/12.2.0/iostream:39,
         次から読み込み:  main.cpp:1:
メンバ関数 ‘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 ‘int main()’ at main.cpp:34:28:
/usr/local/gcc7/include/c++/12.2.0/ostream:202:25: 警告: ‘maxx’ may be used uninitialized [-Wmaybe-uninitialized]
  202 |       { return _M_insert(__n); }
      |                ~~~~~~~~~^~~~~
main.cpp: 関数 ‘int main()’ 内:
main.cpp:16:37: 備考: ‘maxx’ はここで定義されています
   16 |     long long fx, max1, min1, minx, maxx;
      |                                     ^~~~
メンバ関数 ‘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 ‘int main()’ at main.cpp:34:58:
/usr/local/gcc7/include/c++/12.2.0/ostream:202:25: 警告: ‘minx’ may be used uninitialized [-Wmaybe-uninitialized]
  202 |       { return _M_insert(__n); }
      |                ~~~~~~~~~^~~~~
main.cpp: 関数 ‘int main()’ 内:
main.cpp:16:31: 備考: ‘minx’ はここで定義されています
   16 |     long long fx, max1, min1, minx, maxx;
      |                               ^~~~
メンバ関数 ‘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 ‘int main()’ at main.cpp:34:43:
/usr/local/gcc7/include/c++/12.2.0/ostream:202:25: 警告: ‘min1’ may be used uninitialized [-Wmaybe-uninitialized]
  202 |       { return _M_insert(__n); }
      |                ~~~~~~~~~^~~~~
main.cpp: 関数 ‘int main()’ 内:
main.cpp:16:25: 備考: ‘min1’ はここで定義されてい

ソースコード

diff #

#include<iostream>
#include<map>
#include<vector>
#include <algorithm>
#include<math.h>
#include <iomanip>
#include<set>
#include <numeric>
using namespace std;


int main()
{
    int a, b, c, d, p, q;
    cin >> a >> b >> c >> d >> p >> q;
    long long fx, max1, min1, minx, maxx;
    for (int i = p; i <= q; i++){
        fx = a*i*i*i + b*i*i + c*i + d;
        if (i == p){
            min1 = fx;
            minx = p;
            max1 = fx;
            maxx = p;
        }
        if (max1 < fx){
            max1 = fx;
            maxx = i;
        }
        if (min1 > fx) {
            min1 = fx;
            minx = i;
        }
    }
    cout << max1 << " " << maxx << " " << min1 << " " << minx << endl;
}
0