日韩av黄I国产麻豆传媒I国产91av视频在线观看I日韩一区二区三区在线看I美女国产在线I麻豆视频国产在线观看I成人黄色短片

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 >

2014/3/16 长沙多校(第三次)

發布時間:2025/6/17 37 豆豆
生活随笔 收集整理的這篇文章主要介紹了 2014/3/16 长沙多校(第三次) 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

簡介: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 <iostream> 2 #include <string.h> 3 #include <stdio.h> 4 #include <stdlib.h> 5 #define maxn 1000+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")==0) break; 12 int cnt=0,len=strlen(s); 13 for(int i=1;i<len;i++){ 14 int ring=0; 15 for(int j=0;j<cnt;j++) 16 if (i%ans[j]==0) ring=1-ring; 17 if ((s[i]=='0' && ring) ||(s[i]=='1' && !ring)) ans[cnt++]=i; 18 } 19 for(int i=0;i<cnt;i++){ 20 if (i==cnt-1) printf("%d\n",ans[i]);else printf("%d ",ans[i]); 21 } 22 } 23 return 0; 24 } View Code

?Uvalive?6486 - Skyscrapers//第一類斯特林數

轉載于:https://www.cnblogs.com/little-w/p/3608562.html

總結

以上是生活随笔為你收集整理的2014/3/16 长沙多校(第三次)的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。