B. Sherlock and his girlfriend
来源:互联网 发布:百慕达网络超市好不好 编辑:程序博客网 时间:2024/05/17 16:03
#include<cstdio> #include<cstring>#include<iostream>#include<string>using namespace std;int arr[100100];int main(){ for(int i=2;i<100100;i++) if(!arr[i]) for(int j=2;i*j<100100;j++) arr[j*i]=1; int num; cin>>num; int key=0; if(num>=3) { cout<<2<<endl; for(int i=1;i<=num;i++) { if(key)printf(" "); if(arr[i+1])printf("1"); else if(!arr[i+1])printf("2"); key=1; } } else if(num==2) { cout<<1<<endl; cout<<"1 1"; } else if(num==1) {cout<<1<<endl<<1; } return 0;}
0 0
- B. Sherlock and his girlfriend
- B. Sherlock and his girlfriend
- B. Sherlock and his girlfriend
- 【codeforces 776B】Sherlock and his girlfriend
- Codeforces 776B-Sherlock and his girlfriend
- CodeForces 776B Sherlock and his girlfriend
- Sherlock and his girlfriend (Codeforces-776B)
- Sherlock and his girlfriend
- Sherlock and his girlfriend
- 【CodeForces 776B】 Sherlock and his girlfriend (求素数)
- Codeforces Round #400 B.Sherlock and his girlfriend
- Codeforces Round #400 (Div. 1 + Div. 2, combined)B.Sherlock and his girlfriend【预处理素数+思维】
- Codeforces Round #400 (Div. 1 + Div. 2, combined) 776B Sherlock and his girlfriend
- Codeforces Round #400 (Div. 1 + Div. 2, combined) B. Sherlock and his girlfriend 素数筛法+贪心
- Round B APAC Test 2017 Problem A. Sherlock and Parentheses
- B. Drazil and His Happy Friends
- 515B. Drazil and His Happy Friends
- B. Drazil and His Happy Friends
- 理解Servlet过滤器(javax.servlet.Filter) .
- Windows下配置Redis,并修改密码
- safirl流浪器中的返回按钮
- Shiro处理SSL连接
- hdu-2544 最短路
- B. Sherlock and his girlfriend
- PLSQL的介绍
- 部署ftp文件共享服务
- hdu 5728 (欧拉函数性质的应用)
- matplotlib绘图案例
- Android网络通讯库之Okhttp3
- UVALive 4625 Garlands(dp+二分)
- unity JS调用C#出现BCE0019报错的情况
- oracle -plsqly语句