HDU 2020,2021,2024,2028,2029,2030

news/2024/7/4 10:05:18

//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;
}
*/

转载于:https://www.cnblogs.com/syxchina/archive/2010/07/30/2197568.html


http://www.niftyadmin.cn/n/3613034.html

相关文章

linux内存寻址

本章节介绍linux寻址技术&#xff0c;详细描述80x86微处理器怎样进行芯片级的内存寻址&#xff0c;linux又是如何寻址硬件的。 1. linux内存地址 80x86微处理器下主要有三种不同的地址&#xff1a;逻辑地址&#xff0c;线性地址&#xff0c;物理地址。 逻辑地址&#xff1a; 主…

Linux Input Device 介紹: APIs

Linux Input Device 介紹: APIs jollen 發表於 April 8, 2009 12:18 PM Linux 的 Input Device 是重要的一個 subsystem&#xff0c;在進行實例介紹前&#xff0c;先大略了解一下相關的 API。 Linux Input Device &#xfeff;input.c是Linux的”input”驅動程式&#xff0c;主…

Android 如何破解兼容性困局

最新的消息表明&#xff0c;Android 手机的销售量超越 iPhone&#xff0c;虽然在整体市场占有率上&#xff0c;仍然不及竞争对手&#xff0c;但是却已经初现王者风范&#xff0c;一些文章也预测 Android 最终会稳坐智能手机第一把交椅。Android 的确是十分有潜力的&#xff0c;…

webpack学习路径(01.webpack的配置及使用)

对于webpack&#xff0c;我的理解是一种工具提供了友好的前端模块化开发的支持&#xff0c;可以解决代码压缩混淆&#xff0c;浏览器兼容性问题&#xff0c;以及提升性能等主要功能&#xff0c; 安装配置过程&#xff1a; 首先创建一个根目录&#xff08;随便创建一个文件夹&…

C#中直接打印Report文件(rdlc)

Visual Studio自带的报表文件&#xff08;rdlc&#xff0c;后面提到的报表&#xff0c;都指rdlc报表文件&#xff09;虽然功能相对不是十分强大&#xff0c;但应付一般的报表要求也是绰绰有余了。关于rdlc报表的使用和设计方法&#xff0c;这里就不做讲解了&#xff0c;本文主要…

士农工商

中国古代&#xff0c;把商排在了最低等级&#xff0c;其实这是有道理的&#xff0c;商人是滋生腐败的源头&#xff0c;以盈利为目的的运营&#xff0c;只要没有很好的规范&#xff0c;即使牺牲了全世界&#xff0c;也会有人去做&#xff0c;这里的重点就是规范&#xff0c;不过…