zoukankan      html  css  js  c++  java
  • Alex and broken contest CodeForces

    /*
        Name:
        Copyright:
        Author:
        Date: 2018/5/2 10:45:16
        Description:
        要求出现一个朋友的名字,仅一次 
    */
    #include <iostream>
    #include <cstdio>
    #include <string> 
    using namespace std;
    int main()
    {
    //    freopen("in.txt", "r", stdin);
        string fname1 = "Danil";
        string fname2 = "Olya";
        string fname3 = "Slava";
        string fname4 = "Nikita";
        string fname5 = "Ann";
        string str;
        while (cin>>str) {
            int flag = 0;
            if (str.find(fname1) != -1) {
                int pos = 0;
                string tmp = str;
                while ((pos = tmp.find(fname1)) != -1) {
                    flag ++;
                    tmp = tmp.substr(pos + 1);
                    if (flag >= 2) break;
                }
            } 
            if (str.find(fname2) != -1) {
                int pos = 0;
                string tmp = str;
                while ((pos = tmp.find(fname2)) != -1) {
                    flag ++;
                    tmp = tmp.substr(pos + 1);
                    if (flag >= 2) break;
                }
            } 
            if (str.find(fname3) != -1) {
                int pos = 0;
                string tmp = str;
                while ((pos = tmp.find(fname3)) != -1) {
                    flag ++;
                    tmp = tmp.substr(pos + 1);
                    if (flag >= 2) break;
                }
            } 
            if (str.find(fname4) != -1) {
                int pos = 0;
                string tmp = str;
                while ((pos = tmp.find(fname4)) != -1) {
                    flag ++;
                    tmp = tmp.substr(pos + 1);
                    if (flag >= 2) break;
                }
            } 
            if (str.find(fname5) != -1) {
                int pos = 0;
                string tmp = str;
                while ((pos = tmp.find(fname5)) != -1) {
                    flag ++;
                    tmp = tmp.substr(pos + 1);
                    if (flag >= 2) break;
                }
            } 
            if (flag == 1) {
                cout<<"YES"<<endl;
            } else {
                cout<<"NO"<<endl;
            }
        }
        return 0;
    }
  • 相关阅读:
    [Unity3D]计时器/Timer
    unity缓存和浏览器缓存
    unity3d进行脚本资源打包加载
    Unity3d删除无用的美术资源
    项目经理的职责(转载)
    LINQ
    生意经
    Android ListView标题置顶效果实现
    ListView的自动循环滚动显示
    郭霖的专栏
  • 原文地址:https://www.cnblogs.com/langyao/p/8979271.html
Copyright © 2011-2022 走看看