zoukankan      html  css  js  c++  java
  • 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
    ",ans[i]);else printf("%d ",ans[i]);
    21         }
    22     }
    23     return 0;
    24 }
    View Code

     Uvalive 6486 - Skyscrapers//第一类斯特林数

  • 相关阅读:
    USACO 4.1 Fence Rails
    POJ 1742
    LA 2031
    uva 10564
    poj 3686
    LA 3350
    asp.net MVC 3多语言方案--再次写, 配源码
    使用Log4net记录日志
    在C#用HttpWebRequest中发送GET/HTTP/HTTPS请求
    为什么要使用反射机制
  • 原文地址:https://www.cnblogs.com/little-w/p/3608562.html
Copyright © 2011-2022 走看看