Codeforces Round #339 (Div. 2) (B 模拟)
来源:互联网 发布:itunes网络连接超时 编辑:程序博客网 时间:2024/05/30 05:30
这道水题明明不难,然而看错题了,据说这道题用高精度和java大数都是过不去的,一定要注意,数据是十万位,不是小于十万,因为只有一个不美丽数也就是说基本都是0,1,只要把0计数,1超过一次单拿出来,非0非1单拿出来,几乎就没问题了有0的状况,和全都是美丽数的情况要单独考虑一下,哎,还是太菜啊
#include <iostream>#include <string.h>using namespace std;char s[100005],p[100005];int main(){ int T; while(cin>>T) { bool flag=0; long long sum0=0,ans=0; while(T--) { long long len=0,sum1=0; bool flag2=0; memset(s,0,sizeof(s)); cin>>s; len=strlen(s); for(int i=0; i<len; i++) { if(s[i]=='0'&&len==1) { flag=1; break; } else if(s[i]=='1') sum1++; else if(s[i]!='0'&&s[i]!='1') { flag2=1; break; } } if(flag==1) continue; else if(sum1>1||flag2==1) { strcpy(p,s); } else { for(int i=0; i<len; i++) { if(s[i]=='0') sum0++; } } } if(flag==1) { cout<<0<<endl; } else { if(p[0]!=NULL) { cout<<p; } else { cout<<1; } for(int i=1; i<=sum0; i++) cout<<0; cout<<endl; } } return 0;}
0 0
- Codeforces Round #339 (Div. 2) (B 模拟)
- Codeforces Round #339 (Div. 2) (B 模拟)
- Codeforces Round #323 (Div. 2) B 模拟
- Codeforces Round #362 (Div. 2) B 模拟
- Codeforces Round #315 (Div. 2) B 模拟
- Codeforces Round #105 (Div. 2) B 模拟
- Codeforces Round #392 (Div. 2)B (模拟)
- Codeforces Round #256 (Div. 2) B. Suffix Structures(模拟)
- Codeforces Round #107 (Div. 2) B (简单模拟)
- Codeforces Round #265 (Div. 2) B. Inbox (100500)(模拟)
- Codeforces Round #295 (Div. 2) -- B. Two Buttons (模拟)
- Codeforces Round #316 (Div. 2) B. Simple Game (模拟)
- Codeforces Round #346 (Div. 2)(B)排序,模拟
- Codeforces Round #303 (Div.2)-B. Equidistant String(模拟)
- Codeforces Round #347 (Div. 2)-B. Rebus(模拟)
- Codeforces Round #354 (Div. 2)(B)模拟
- Codeforces Round #354 (Div. 2) B (模拟)
- Codeforces Round #355 (Div. 2)B(模拟)
- json字符串与json对象的区别
- 如何选择 compileSdkVersion, minSdkVersion 和 targetSdkVersion
- 【CodeForces 397A 】On Segment's Own Points(水题)
- hdu 2151
- Top k问题(线性时间选择算法)
- Codeforces Round #339 (Div. 2) (B 模拟)
- android 双击返回键退出应用核心代码
- Linux 系统应用编程——标准I/O
- PopupWindow 笔记
- 懒加载
- 【akMOOC】2 多条printf输出
- 对指定文件夹下指定类型文件的读取
- ZOJ 3947 Very Happy Great BG(水题)
- 驱动程序的取消IRP