简介:2013 ACM ICPC Southeast USA Regional Programming Contest
原地址:https://icpcarchive.ecs.baylor.edu/index.php?option=com_onlinejudge&Itemid=8&category=625
Uvalive 6484://类似于素数筛的思想
1 #include
2 #include <string.h>
3 #include
4 #include
5 #define maxn 1000&#43;5
6 using namespace std;
7 char s[maxn];
8 int ans[maxn];
9 int main(){
10 while(~scanf("%s",s)){
11 if (strcmp(s,"0")&#61;&#61;0) break;
12 int cnt&#61;0,len&#61;strlen(s);
13 for(int i&#61;1;i
14 int ring&#61;0;
15 for(int j&#61;0;j
16 if (i%ans[j]&#61;&#61;0) ring&#61;1-ring;
17 if ((s[i]&#61;&#61;&#39;0&#39; && ring) ||(s[i]&#61;&#61;&#39;1&#39; && !ring)) ans[cnt&#43;&#43;]&#61;i;
18 }
19 for(int i&#61;0;i
20 if (i&#61;&#61;cnt-1) printf("%d\n",ans[i]);else printf("%d ",ans[i]);
21 }
22 }
23 return 0;
24 }
Uvalive 6486 - Skyscrapers//第一类斯特林数