zoukankan      html  css  js  c++  java
  • HDU 2020,2021,2024,2028,2029,2030

    //Made by syx
    //Time 2010年7月29日 09:55:28
    //
    //2020 绝对值排序
    //2021 发工资咯:)
    //2024 C语言合法标识符
    //2028 Lowest Common Multiple Plus
    //2029 Palindromes_easy version 回文串
    //2030 汉字统计

    /*
    //2030 汉字统计
    #include <iostream>
    #include <string>
    using namespace std;
    int main()
    {
    string s;
    int n,i,count;
    cin>>n;
    getchar();
    while(n--)
    {
       count = 0;
       //gets(s);
       //getline(cin,s);
       //cin>>s;
       //cin.ignore(1024,'\n');
       //cin.unsetf(ios::skipws);
       //cout<<s<<endl;
       //for(i=0; i<s.length(); ++i)
       //{
       // if(s[i] < 0)
       //   count++;
       //}
       char ch;
       while(cin.get(ch)&&ch != '\n')
       {
        if(ch < 0)
         count++;
       }
       cout<<count/2<<endl;
    }
    return 0;
    }
    */
    /*
    #include <iostream>
    #include <string>
    using namespace std;
    int main()
    {
    char *s ="Welcome To Beijing";
    char * t = strrev(strdup(s));
    cout<<s<<" "<<t<<endl;
    return 0;
    }*/
    /*
    //2029 Palindromes_easy version 回文串
    #include <stdio.h>
    #include <string.h>

    int main()
    {
    char s[1024],t[1024];
    int n;
    scanf("%d%*c",&n);
    while(n--)
    {
       gets(s);
       strcpy(t,s);
       strrev(s);
       puts(strcmp(t,s) ? "no" : "yes");
    }
    return 0;
    }
    */

    /*
    //2028 Lowest Common Multiple Plus

    #include <iostream>
    using namespace std;
    int GCD(int a,int b)
    {
    int i,temp_gcd;
    for(i=a; i>=1; --i)
    {
       if(a%i == 0 && b%i == 0)
       {
        temp_gcd = i;
        return temp_gcd;
       }
    }
    return 1;
    }

    int LCM(int a,int b)
    {
    int temp_lcm;
    temp_lcm = a / GCD(a,b) * b;
    //这是个陷阱,如果写成a * b / GCD(a,b);就会溢出WA!
    return temp_lcm;
    }
    int main()
    {
    int n,res,temp;
    while(cin>>n)
    {
       res = 1;
       while(n--)
       {
        cin>>temp;
        res = LCM(res,temp);
       }
       cout<<res<<endl;
    }
    return 0;
    }
    */
    /*
    //求2个数的最大公倍数和最小公约数
    #include <iostream>
    using namespace std;

    int GCD(int a,int b)
    {
    int i,temp_gcd;
    for(i=a; i>=1; --i)
    {
       if(a%i == 0 && b%i == 0)
       {
        temp_gcd = i;
        return temp_gcd;
       }
    }
    }

    int LCM(int a,int b)
    {
    int temp_lcm;
    temp_lcm = a * b / GCD(a,b);
    return temp_lcm;
    }
    int main()
    {
    int num1,num2,gcd,lcm;//最大公约数
    cin>>num1>>num2;//最小公倍数
    gcd = GCD(num1,num2);
    lcm = LCM(num1,num2);
    cout<<gcd<<" "<<lcm<<endl;
    return 0;
    }
    */


    /*
    //2024 C语言合法标识符
    #include <iostream>
    #include <string>
    using namespace std;

    int main()
    {
    int n,i;
    cin>>n;
    while(n--)
    {
       string s;
       cin>>s;
       int d = 1;
       if(s[0]!='_'&& !isalpha(s[0]))
       {
        cout<<"no"<<endl;
        continue;
       }
       for(i=1; s[i]; ++i)
       {
        if (!isalnum(s[i]) && s[i] != '_')
        {
         d = 0;
         break;
        }
       }
      
       if(d)
        cout<<"yes"<<endl;
       else
        cout<<"no"<<endl;

    }

    return 0;
    }
    */

    /*
    //2021 发工资咯:)
    //Accepted 2021 15MS 244K 521 B C++ syx_China
    #include <iostream>
    using namespace std;

    int sum = 0;

    void countMenoy(int count)
    {
    while(count)
    {
       if(count>=100)
        count -= 100;
       else if(count>=50)
        count -=50;
       else if(count>=10)
        count -=10;
       else if(count>=5)
        count -= 5;
       else if(count>=2)
        count -= 2;
       else
        count --;

       sum++;
    }
    }

    void countMenoy2(int count)
    {
    sum += count/100;
    count %= 100;
    sum += count/50;
    count %= 50;
    sum += count/10;
    count %= 10;
    sum += count/5;
    count %= 5;
    sum += count/2;
    count %= 2;
    sum += count;
    return ;
    }

    int main()
    {
    int n,i;

    int p;
    while(cin>>n&&n)
    {
       sum = 0;
       for(i=0; i<n; ++i)
       {
        cin>>p;
        //countMenoy(p);
        countMenoy2(p);
       }
       cout<<sum<<endl;
      
    }
    return 0;
    }
    */

    /*
    //2020 绝对值排序
    //Accepted 2020 0MS 240K 373 B C++ syx_China
    #include <iostream>
    using namespace std;

    int cmp(const void *a,const void *b)
    {
    return abs(*(int*)a) - abs(*(int*)b);
    }

    int main()
    {
    int x[100] = {0};
    int n;
    while(cin>>n&&n)
    {
       int i = 0;
       for( ; i<n; ++i)
        cin>>x[i];
       qsort(x,n,sizeof(int),cmp);
       for(i=n-1; i>0; --i)
       {
        cout<<x[i]<<" ";
       }
       cout<<x[i]<<endl;
    }

    return 0;
    }
    */

    作者:BuildNewApp
    出处:http://syxchina.cnblogs.comBuildNewApp.com
    本文版权归作者、博客园和百度空间共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则作者会诅咒你的。
    如果您阅读了我的文章并觉得有价值请点击此处,谢谢您的肯定1。
  • 相关阅读:
    win10 下安装 tesseract + tesserocr
    win 10 家庭中文版安装docker ,但是没有 Hyper-V , 这样一步搞定
    Pycharm 分屏
    cookie 和 session
    retrying 模块
    Pychram 运行程序在 run 窗口和 python console 窗口之间切换
    封装、继承、多态
    泛型、反射、注解
    多线程笔记
    多线程
  • 原文地址:https://www.cnblogs.com/syxchina/p/2197568.html
Copyright © 2011-2022 走看看