Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
AC代码#include<bits/stdc++.h> using namespace std; vector<int> degree; int E, V; int M; int main() { ios_base::sync_with_stdio(false); string tmps; while(cin >> tmps && tmps != "ENDOFINPUT") { cin >> M >> V; E = 0; int u = 0, v; stringstream ss;//作为一名极度依赖C++的人... degree.clear(); degree.resize(V, 0); getline(cin, tmps); while(getline(cin, tmps) && tmps != "END") { ss.clear(); ss << tmps; while(ss >> v) { E++; degree[u]++; degree[v]++; } u++; } int flag = 0; for(int i = 0; i < V; i++) { if(degree[i] & 1) { flag++; } } if(flag == 0 && M == 0) { cout << "YES " << E << endl; } else { if(flag == 2 && (degree[M] & 1) && (degree[0] & 1) && M != 0) { cout << "YES " << E << endl; } else { cout << "NO" << endl; } } } return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator