P6 早上好YTP - Good Morning YTP
unknown
c_cpp
2 years ago
377 B
7
Indexable
#include <iostream> using namespace std; int N, M, x, y; int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); cin >> N >> M; // 直鏈,前 N-1 條邊一加入即為橋 // 自第 N 條邊後開始產生循環,即不存在任何橋 for(int i = 1; i <= M; ++i) { cin >> x >> y; cout << ((i <= N-1)? i : 0) << "\n"; } }
Editor is loading...