首页 > 其他分享 >POJ - 3318

POJ - 3318

时间:2024-09-04 18:47:58浏览次数:4  
标签:include int cin 3318 POJ 505

他说:O(n^3)是过不了滴
一搜……
6
代码和题解没有实质区别:

#include<cstdio>
#include<ctime>
#include<cstdlib>
using namespace std;
int a[505][505],b[505][505],c[505][505];
int main(){
	srand(time(NULL));
	int n;
	ios::sync_with_stdio(0);
	cin.tie(0);
	while(cin>>n){
		for(int i=1;i<=n;i++)for(int j=1;j<=n;j++)cin>>a[i][j];
		for(int i=1;i<=n;i++)for(int j=1;j<=n;j++)cin>>b[i][j];
		for(int i=1;i<=n;i++)for(int j=1;j<=n;j++)cin>>c[i][j];
		bool f=0;
		for(int t=0;t<60000;t++){
			int row=rand()%n+1;
			int col=rand()%n+1;
			int num=0;
			for(int i=1;i<=n;i++)
				num=num+a[row][i]*b[i][col];
			if(num!=c[row][col]){f=1;break;}
		}
		if(!f)printf("Yes\n");
		else printf("No\n");
	}
	return 0;
}

标签:include,int,cin,3318,POJ,505
From: https://www.cnblogs.com/zan-mei-tai-yang/p/18397171

相关文章

  • POJ - 1765
    第一次做扫描线挺好的#include<cstdio>#include<cstring>#include<algorithm>usingnamespacestd;structppx{ intl,r; doubleleft,right; doublelen; intcover;//记录重边情况}tree[4*200+10];doubley[200+10];//对应的序号装对应的边structpp{ doublex......
  • POJ - 1870
    先把蜂巢快递柜画出来:__________/\__/\__/\__/\____/\__/\__/53\__/\__/\__/\__/\__/52\__/54\__/\__/\\__/\__/51\__/31\__/55\__/\__//\__/50\__/30\__/32\__/56\__/\\__/49\__/29\__......
  • POJ - 3318
    他说:O(n^3)是过不了滴一搜……6代码和题解没有实质区别:#include<cstdio>#include<ctime>#include<cstdlib>usingnamespacestd;inta[505][505],b[505][505],c[505][505];intmain(){ srand(time(NULL)); intn; ios::sync_with_stdio(0); cin.tie(0); while(cin......
  • POJ - 2976
    原来是二分谁对平均分贡献大选谁界限<0.001,100次足矣#include<iostream>#include<cstdio>#include<algorithm>#include<cstring>usingnamespacestd;constintmaxn=1010;intn,k;doublemid;structNode{ doublea,b;}w[maxn];boolcmp(Nodex,Nodey......
  • POJ - 3071
    概率题。本蒟蒻不会概率dp,于是手搓枚举。反正爆枚够用后记:SadBee的想法考虑维护每队对上上一队/下一队的胜率。只有两队最简单,用1乘即可那多队呢?不如看成两队。见:P(1胜)=P(1战胜2)P(3战胜4)P(1战胜3)+P(1战胜2)P(4战胜3)P(1战胜4)P(2胜)=......
  • POJ1321-棋盘问题
    POJ从23号崩了,放弃POJ(也不知是不是有比赛把oj都关了),各大OJLeetcode/PAT各种花里胡哨开会员能数据,它不配正经刷题牛客网招聘多课程广告多我焦虑不想入hdoj和洛谷不错,找了找搜索算法的题目单,之前看过数一巨巨写的知乎:邝斌带你飞专题,无限回忆西安艾教培训,卿俊888上交知乎咨询,科技......
  • TopoJSON格式详解,写入读取TopoJSON示例
    还是大剑师兰特:曾是美国某知名大学计算机专业研究生,现为航空航海领域高级前端工程师;CSDN知名博主,GIS领域优质创作者,深耕openlayers、leaflet、mapbox、cesium,canvas,webgl,echarts等技术开发,欢迎加底部微信(gis-dajianshi),一起交流。No.内容链接1Openlayers【入门教程】-......
  • D40 2-SAT POJ3683 Priest John's Busiest Day
    视频链接:D402-SATPOJ3683PriestJohn'sBusiestDay_哔哩哔哩_bilibili   POJ3683--PriestJohn'sBusiestDay(poj.org)#include<cstdio>#include<cstring>#include<iostream>#include<algorithm>usingnamespacestd;......
  • SPOJ COT3 - Combat on a tree
    挺好的一个题,算是博弈和DS的有机结合这类问题一眼考虑SG函数,同时树上的SG函数一般都是从子树向上递推考虑若某个点的子树内全是黑点,则其SG函数为零;否则考虑枚举所有的后继状态不难发现选中一个白点会把这个子树断成一个森林,这个后继状态的SG函数就是每个连通块SG函......
  • flink stream转table POJO对象遇到的坑
    核心代码publicclassTrackLog{privateIntegerentityId;//flink的时间类型,必须使用LocalDateTimeprivateLocalDateTimestatDateTime; publicIntegergetEntityId(){returnentityId;}publicvoidsetEntityId(IntegerentityId){......