zoukankan      html  css  js  c++  java
  • 【PAT】2-2 一元多项式求导

    #include <iostream>
    #include <algorithm>
    #include <cstdlib>
    #include <cstdio>
    #include <string>
    #include <cstring>
    #include <cmath>
    #include <ctime>
    using namespace std;
    
    
    #define read() freopen("in.txt", "r", stdin)
    #define write() freopen("out.txt", "w", stdout)
    #define rep( i , a , b ) for ( int i = ( a ) ; i <  ( b ) ; ++ i )  
    #define For( i , a , b ) for ( int i = ( a ) ; i <= ( b ) ; ++ i ) 
    #define clr( a , x ) memset ( a , x , sizeof a )  
    #define cpy( a , x ) memcpy ( a , x , sizeof a ) 
    #define max(a,b) (a>b)?(a):(b)
    #define LL long long 
    
    struct daoshu
    {
    	int n;
    	int e;
    };
    daoshu temp[1002];
    daoshu num[1002];
    int main()
    {
    	read(); 
        int x,y;
        int index=0,k=0;
        while(scanf("%d%d",&x,&y)!=EOF)
        {
        	temp[index].n = x;
        	temp[index++].e = y;
        }
        for (int i = 0; i < index; ++i)
        {
        	if (temp[i].e)
        	{
        		num[k].n = temp[i].n*temp[i].e;
        		num[k++].e = temp[i].e - 1;
        	}
        }
        if (k == 0)
        {
        	printf("0 0
    ");
        	return 0;
        }
        for (int i = 0; i < k; ++i)
        {
        	printf("%d %d",num[i].n,num[i].e);
        	if (i-k+1)
        	{
        		printf(" ");
        	}else
        	{
        		printf("
    ");
        	}
        }
        return 0;
       
    }
    

      

  • 相关阅读:
    linux-log-files/
    SSL SSH
    C++学习的书籍
    Linux IO 分析
    LINUX 常用操作
    Find Large Files in Linux
    Linux 常见操作
    Linux Performance tool
    /linux-command-line-bash-shortcut-keys/
    Sed
  • 原文地址:https://www.cnblogs.com/acmsummer/p/4352572.html
Copyright © 2011-2022 走看看