zoukankan      html  css  js  c++  java
  • UVA10763:Foreign Exchange&&UVA10340: All in All(水题)

    10763:水题不解释直接贴代码。

    #include <iostream>
    #include <string.h>
    #include <stdio.h>
    #include <algorithm>
    #include <math.h>
    #include <queue>
    #define eps 1e-9
    typedef long long ll;
    using namespace std;
    int n;
    int d[500100];
    int main()
    {
        int xx,yy;
        while(scanf("%d",&n)!=EOF&&n!=0)
        {
            memset(d,0,sizeof(d));
            for(int i=0;i<n;i++)
            {
                scanf("%d%d",&xx,&yy);
                d[xx]--;
                d[yy]++;
            }
            bool ff=false;
            for(int i=1;i<=500000;i++)
            {
                if(d[i])
                {
                    printf("NO
    ");
                    ff=true;
                    break;
                }
            }
            if(!ff) printf("YES
    ");
        }
        return 0;
    }

    10340:判断a串是不是b串的子串。水题。

    #include <iostream>
    #include <string.h>
    #include <stdio.h>
    #include <algorithm>
    #include <math.h>
    #include <queue>
    #define eps 1e-9
    typedef long long ll;
    using namespace std;
    char a[1000001],b[1000001];
    int main()
    {
        while(scanf("%s%s",a,b)!=EOF)
        {
            int t=0;
            int l1=strlen(a);
            int l2=strlen(b);
            for(int i=0;i<l2;i++)
            {
                if(a[t]==b[i])
                {
                    t++;
                }
                if(t==l1) break;
            }
            if(t==l1) printf("Yes
    ");
            else printf("No
    ");
        }
        return 0;
    }
  • 相关阅读:
    种子销售管理需求
    三角函数
    软件人性化的体现
    三角函数
    ProductManager
    不能说的秘密
    种子销售管理需求
    JTable使用
    不能说的秘密
    设计模式(了解篇)转载
  • 原文地址:https://www.cnblogs.com/zhangmingcheng/p/4271354.html
Copyright © 2011-2022 走看看