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;
    }
  • 相关阅读:
    C open fopen read fread
    图像混合模式算法
    高级API和低级API
    strcpy_s与strcpy
    IsPowerOfTwo
    透明度算法
    POJ 2240(bellman_ford)
    POJ 1797(dijkstra)
    【转载】POJ 图论题目列表
    POJ 1502(Floyd)
  • 原文地址:https://www.cnblogs.com/zhangmingcheng/p/4271354.html
Copyright © 2011-2022 走看看