UOJ Logo

NOI.AC

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#212547#3839. 小t爱算数(mul)xiangjyCompile Error//C++2.2kb2024-10-19 11:06:222024-10-19 12:34:56

answer

#include<iostream>
#include<algorithm>
#include<cmath>
using namespace std;
/*
\\\\ \\ \\ \\ \\ \\ \\ \\ || || || || || || // // // // // // // ////
\\\\ \\ \\ \\ \\ \\ \\        _ooOoo_          // // // // // // ////
\\\\ \\ \\ \\ \\ \\          o8888888o            // // // // // ////
\\\\ \\ \\ \\ \\             88" . "88               // // // // ////
\\\\ \\ \\ \\                (| -_- |)                  // // // ////
\\\\ \\ \\                   O\  =  /O                     // // ////
\\\\ \\                   ____/`---'\____                     // ////
\\\\                    .'  \\|     |//  `.                      ////
//==                   /  \\|||  :  |||//  \                     ==\\
//==                  /  _||||| -:- |||||-  \                    ==\\
//==                  |   | \\\  -  /// |   |                    ==\\
//==                  | \_|  ''\---/''  |   |                    ==\\
//==                  \  .-\__  `-`  ___/-. /                    ==\\
//==                ___`. .'  /--.--\  `. . ___                  ==\\
//==             ."" '<  `.___\_<|>_/___.'  >' "".               ==\\
//==            | | :  `- \`.;`\ _ /`;.`/ - ` : | |              \\\\
////            \  \ `-.   \_ __\ /__ _/   .-` /  /              \\\\
////      ========`-.____`-.___\_____/___.-`____.-'========      \\\\
////                           `=---='                           \\\\
//// //   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^  \\ \\\\
//// // //      佛祖保佑      永无BUG      永不修改        \\ \\ \\\\
//// // // // // // || || || || || || || || || || \\ \\ \\ \\ \\ \\\\
*/
int a[1000010],b[1000010],c[1000010];
int main(){
	int x,y;
	while(1) {
		scanf("%d",&x);
		if(x==-1) break;
		scanf("%d",&y);
		a[x]+=y;
	}
	while(1) {
		scanf("%d",&x);
		if(x==-1) break;
		scanf("%d",&y);
		b[x]+=y;
	}
	for(int i=0; i<=1000; i++) {
		for(int j=0; j<=1000; j++) {
			c[i+j]+=(a[i]*b[j]);
		}
	}
	bool flag=0;
	for(int i=100010; i>=0; i--) {
		if(c[i]==0) continue;
		if(c[i]>0&&flag) printf("+");
		if(c[i]<0) {
			printf("-");
			c[i]=-c[i];
		}
		if(c[i]!=1||c[i]==1&&i==0) {
			printf("%d",c[i]);
		}
		if(i>0) printf("x^%d",i);
		flag=1;
	}
	return 0;
}

Details

answer.code: In function 'int main()':
answer.code:33:16: error: 'scanf' was not declared in this scope
   scanf("%d",&x);\x0d
                ^
answer.code:39:16: error: 'scanf' was not declared in this scope
   scanf("%d",&x);\x0d
                ^
answer.code:52:30: error: 'printf' was not declared in this scope
   if(c[i]>0&&flag) printf("+");\x0d
                              ^
answer.code:54:14: error: 'printf' was not declared in this scope
    printf("-");\x0d
              ^
answer.code:58:20: erro...