Run ID 作者 问题 语言 测评结果 分数 时间 内存 代码长度 提交时间
99030 梁晨熙 二进制半整数 C++ 解答错误 60 4 MS 244 KB 484 2023-08-21 16:23:09

Tests(3/5):


#include<bits/stdc++.h> using namespace std; int t,n; string solveb(int t,int r){ string ans=""; while(t!=0){ int f=t%r; t/=r; if(f<10){ ans=((char)(f+'0'))+ans; } else{ ans=((char)((f-10)+'A'))+ans; } } return ans; } int main(){ cin>>t; while(t--){ int cnt=0; cin>>n; string k=solveb(n,2); for(int i=0;i<k.size();i++){ if(k[i]=='1') cnt++; } if(cnt<=2) cout<<"yes"<<endl; else cout<<"no"<<endl; } return 0; }


测评信息: