Run ID 作者 问题 语言 测评结果 分数 时间 内存 代码长度 提交时间
38427 23级徐泽厚 【J】T1 C++ 通过 100 1 MS 248 KB 617 2025-10-08 14:02:12

Tests(10/10):


#include <bits/stdc++.h> #define int long long using namespace std; int t,n,m; signed main(){ // ios::sync_with_stdio(0); // cin.tie(0);cout.tie(0); cin>>t; while (t--){ cin>>n>>m; if (n%2==1 and m%2==1){ cout<<"N\n"; cout<<"-1\n"; } else if (n%2==0 and m%2==0){ cout<<"Y\n"; cout<<(n/2)*(m/2)<<"\n"; } else{ if (n%2==1){ swap(n,m); } cout<<"Y\n"; cout<<n/2+(n/2)*(m/2)<<"\n"; } } return 0; }


测评信息: