0
点赞
收藏
分享

微信扫一扫

C++编译不知道出了什么问题(LG2364)

萨科潘 2022-01-09 阅读 34
#include <cstdio>
#include <iostream>
#include <cstring>
#include <algorithm>
using namespace std;
int f[110][110][110][4][4][4],mi[110][110][110][4][4][4],len[3],cnt;
struct node
{
	int a,b,c,d,e,f;
}rec[110][110][110][4][4][4];
char ch[3][110],san[110];
void pt(int a,int b,int c,int d,int e,int f)
{
	if (a==0) return;
	san[++cnt]=ch[0][a];
	pt(rec[a][b][c][d][e][f].a,
	rec[a][b][c][d][e][f].b,
	rec[a][b][c][d][e][f].c,
	rec[a][b][c][d][e][f].d,
	rec[a][b][c][d][e][f].e,
	rec[a][b][c][d][e][f].f);
	return;
}
int main()
{
	for (int i=0;i<=2;i++)
	{
		scanf("%s",ch[i]+1);
		len[i]=strlen(ch[i]+1);
	}
	for (int i=1;i<=len[0];i++)
		for (int j=1;j<=len[1];j++)
			for (int k=1;k<=len[2];k++)
			{
				if ((ch[0][i]!=ch[1][j]) || (ch[1][j]!=ch[2][k])) continue;
				for (int l1=0;l1<=3;l1++)
					for (int l2=0;l2<=3;l2++)
						for (int l3=0;l3<=3;l3++)
						{
							int s=f[i][j][k][l1][l2][l3];
							for (int i1=(i-l1-4);i1<(i-l1);i1++)
								for (int j1=(j-l2-4);j1<(j-l2);j1++)
									for (int k1=(k-l3-4);k1<(k-l3);k1++)
									{
										int s1=3-(i-i1-l1-1),s2=3-(j-j1-l2-1),s3=3-(k-k1-l3-1);
										if (s<mi[i1][j1][k1][s1][s2][s3]+1)
										{
											s=mi[i1][j1][k1][s1][s2][s3]+1;
											rec[i][j][k][l1][l2][l3]=node{i1,j1,k1,s1,s2,s3};
										}
									}
							f[i][j][k][l1][l2][l3]=s;				
						}
				for (int l1=0;l1<=3;l1++)
					for (int l2=0;l2<=3;l2++)
						for (int l3=0;l3<=3;l3++)
						{
							int s=mi[i][j][k][l1][l2][l3];
							for (int s1=0;s1<=l1;s1++)
								for (int s2=0;s2<=l2;s2++)
									for (int s3=0;s3<=l3;s3++)
										s=max(s,f[i][j][k][s1][s2][s3]);
							mi[i][j][k][l1][l2][l3]=s;
						}
			}
		int a,b,c,d,e,e1,ans=0;
		for (int i=1;i<=len[0];i++)
			for (int j=1;j<=len[1];j++)
				for (int k=1;k<=len[2];k++)
					for (int l1=0;l1<=3;l1++)
						for (int l2=0;l2<=3;l2++)
							for (int l3=0;l3<=3;l3++)
								if (ans<f[i][j][k][l1][l2][l3])
								{
									ans=f[i][j][k][l1][l2][l3];
									a=i;
									b=j;
									c=k;
									d=l1;
									e=l2;
									e1=l3;
								}
		pt(a,b,c,d,e,e1);
		for (int i=cnt;i>0;i--)
			printf("%c",san[i]);
		return 0;
}

xukejie@Xukejie-ZorinOS:~/桌面$ g++ E.cpp
/tmp/ccnTrwie.o: in function pt(int, int, int, int, int, int)': E.cpp:(.text+0x4c): relocation truncated to fit: R_X86_64_PC32 against symbolch’ defined in .bss section in /tmp/ccnTrwie.o
E.cpp:(.text+0x5a): relocation truncated to fit: R_X86_64_PC32 against symbol san' defined in .bss section in /tmp/ccnTrwie.o /tmp/ccnTrwie.o: in functionmain’:
E.cpp:(.text+0x3ec): relocation truncated to fit: R_X86_64_PC32 against symbol ch' defined in .bss section in /tmp/ccnTrwie.o E.cpp:(.text+0x41a): relocation truncated to fit: R_X86_64_PC32 against symbolch’ defined in .bss section in /tmp/ccnTrwie.o
E.cpp:(.text+0x4b1): relocation truncated to fit: R_X86_64_PC32 against symbol ch' defined in .bss section in /tmp/ccnTrwie.o E.cpp:(.text+0x4c4): relocation truncated to fit: R_X86_64_PC32 against symbolch’ defined in .bss section in /tmp/ccnTrwie.o
E.cpp:(.text+0x4df): relocation truncated to fit: R_X86_64_PC32 against symbol ch' defined in .bss section in /tmp/ccnTrwie.o E.cpp:(.text+0x4f2): relocation truncated to fit: R_X86_64_PC32 against symbolch’ defined in .bss section in /tmp/ccnTrwie.o
E.cpp:(.text+0xf02): relocation truncated to fit: R_X86_64_PC32 against symbol san' defined in .bss section in /tmp/ccnTrwie.o /tmp/ccnTrwie.o: in function__static_initialization_and_destruction_0(int, int)’:
E.cpp:(.text+0xf59): relocation truncated to fit: R_X86_64_PC32 against `.bss’
E.cpp:(.text+0xf6c): 从输出所省略的额外重寻址溢出
collect2: error: ld returned 1 exit status

举报

相关推荐

0 条评论