結果
| 問題 |
No.280 歯車の問題(1)
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-04-13 21:38:20 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 3 ms / 1,000 ms |
| コード長 | 420 bytes |
| コンパイル時間 | 651 ms |
| コンパイル使用メモリ | 69,596 KB |
| 最終ジャッジ日時 | 2025-01-09 18:12:53 |
|
ジャッジサーバーID (参考情報) |
judge5 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 31 |
コンパイルメッセージ
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 ‘void solve()’ at main.cpp:18:30:
/usr/include/c++/13/ostream:204:25: warning: ‘l’ may be used uninitialized [-Wmaybe-uninitialized]
204 | { return _M_insert(__n); }
| ~~~~~~~~~^~~~~
main.cpp: In function ‘void solve()’:
main.cpp:10:10: note: ‘l’ was declared here
10 | lint l, r;
| ^
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 solve()’ at main.cpp:18:18:
/usr/include/c++/13/ostream:204:25: warning: ‘r’ may be used uninitialized [-Wmaybe-uninitialized]
204 | { return _M_insert(__n); }
| ~~~~~~~~~^~~~~
main.cpp: In function ‘void solve()’:
main.cpp:10:13: note: ‘r’ was declared here
10 | lint l, r;
| ^
ソースコード
#include <iostream>
#include <vector>
using lint = long long;
void solve() {
int n;
std::cin >> n;
lint l, r;
for (int i = 0; i < n; ++i) {
lint x;
std::cin >> x;
if (i == 0) l = x;
if (i == n - 1) r = x;
}
std::cout << r << "/" << l << std::endl;
}
int main() {
std::cin.tie(nullptr);
std::ios::sync_with_stdio(false);
solve();
return 0;
}