HDU 2019-2020

终于刷完了hdu上29道简单题,接下来去zoj上继续刷30道简单题。继续加油

HDU 2019

 /* THE PROGRAM IS MADE BY SH */
/*---------------------------------------------------------------------------
 *       http://acm.hdu.edu.cn/showproblem.php?pid=2019
 *       数列有序!  
 *       Date  : 2015/5/2 
----------------------------------------------------------------------------*/
#include 
#include 
#include 
#include 
#include 
#include 
#include 

using namespace std;
int a[100] = {0};
int main()
{
  int n,m,temp;
  while(scanf("%d%d",&n,&m) !=EOF && n <=100 && n >=0){
       if(n == 0 && m == 0) continue;
      for(int i = 0; i a[i+1]){
                  temp = a[i];
                  a[i] = a[i+1];
                  a[i+1] = temp;
              }
          } 
      }
      for(int i = 0; i < n+1; ++i ){
          printf("%d",a[i]);
          if(i != n) printf(" ");
          else printf("\n");
      }
 }   
  system("Pause");
  return 0;
}

HDU 2020

 /* THE PROGRAM IS MADE BY SH */
/*---------------------------------------------------------------------------
 *       http://acm.hdu.edu.cn/showproblem.php?pid=2020
 *       绝对值排序
 *       Date  : 2015/5/6
----------------------------------------------------------------------------*/
#include 
#include 
#include 
#include 
#include 
#include 
#include 

using namespace std;
int a[101] = {0};
int main()
{
  int n,temp;
  while(scanf("%d",&n) != EOF && n <= 100){
      if(n == 0) continue;
      for(int i = 0;i < n;++i){
          scanf("%d",&a[i]);
      }
      for(int j = 0; j < n-1; ++j){
          for(int i = 0; i < n-1-j; ++i){
               if(abs(a[i])


你可能感兴趣的:(入门题)