結果

問題 No.1132 凸凹
ユーザー kpinkcat
提出日時 2023-08-27 00:47:46
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 716 bytes
コンパイル時間 1,151 ms
コンパイル使用メモリ 101,112 KB
最終ジャッジ日時 2025-02-16 14:56:42
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 26
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:25:9: warning: ‘max1’ may be used uninitialized [-Wmaybe-uninitialized]
   25 |         if (max1 < fx){
      |         ^~
main.cpp:16:19: note: ‘max1’ was declared here
   16 |     long long fx, max1, min1, minx, maxx;
      |                   ^~~~
main.cpp:29:9: warning: ‘min1’ may be used uninitialized [-Wmaybe-uninitialized]
   29 |         if (min1 > fx) {
      |         ^~
main.cpp:16:25: note: ‘min1’ was declared here
   16 |     long long fx, max1, min1, minx, maxx;
      |                         ^~~~
In file included from /usr/include/c++/13/iostream:41,
                 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 ‘int main()’ at main.cpp:34:58:
/usr/include/c++/13/ostream:204:25: warning: ‘minx’ may be used uninitialized [-Wmaybe-uninitialized]
  204 |       { return _M_insert(__n); }
      |                ~~~~~~~~~^~~~~
main.cpp: In function ‘int main()’:
main.cpp:16:31: note: ‘minx’ was declared here
   16 |     long long fx, max1, min1, minx, maxx;
      |                               ^~~~
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 ‘int main()’ at main.cpp:34:28:
/usr/include/c++/13/ostream:204:25: warning: ‘maxx’ may be used uninitialized [-Wmaybe-uninitialized]
  204 |       { return _M_insert(__n); }
      |                ~~~~~~~~~^~~~~
main.cpp: In function ‘int main()’:
main.cpp:16:37: note: ‘maxx’ was declared here
   16 |     long long fx, max1, min1, minx, maxx;
      |                                     ^~~~

ソースコード

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