4 条题解
-
1
思路
暴力出奇迹,打表出省一
解题方法
一边判断一边走
复杂度
全是判断包是O(1)
时间复杂度:
空间复杂度:
Code
#include<bits/stdc++.h> using namespace std; int main(){ int a; cin>>a; if(a==1)cout<<"NO"; else if(a==2)cout<<"NO"; else if(a==3)cout<<"NO"; else if(a==4)cout<<"NO"; else if(a==6)cout<<"NO"; else if(a==10)cout<<"NO"; else if(a==12)cout<<"NO"; else if(a==16)cout<<"NO"; else if(a==18)cout<<"NO"; else cout<<"YES"; return 0; }
-
-5
O(1)水过
思路
暴力出奇迹,打表出省一
解题方法
将0!~20!依次除1~21
复杂度
时间复杂度:
空间复杂度:
Code
#include<bits/stdc++.h> using namespace std; string s[20]={"YES","NO","NO","NO","NO", "YES","NO","YES","YES","YES", "NO","YES","NO","YES","YES", "YES","NO","YES","NO","YES"}; int main() { int n; cin>>n; cout<<s[n]<<endl; return 0; }
- 1
信息
- ID
- 54
- 时间
- 1000ms
- 内存
- 512MiB
- 难度
- 1
- 标签
- 递交数
- 430
- 已通过
- 283
- 上传者