• 【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;
       
    }
    

      

  • 相关阅读:
    curl 文件上传
    地区选择三级联动
    水平居中
    z-index
    css垂直居中
    Enrolment API
    阿里云OSS存储
    java中的vo、dto 、dao
    Spring mvc 中使用 kaptcha 验证码
    将下载的本地的jar手动添加到maven仓库
  • 原文地址:https://www.cnblogs.com/acmsummer/p/4352572.html
Copyright © 2020-2023  润新知