답안 #661442

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
661442 2022-11-25T18:52:49 Z developerziya Pairs (IOI07_pairs) C++14
컴파일 오류
0 ms 0 KB
#include<stdio.h>
#include<iostream>
#include<vector>
using namespace std;
int main (){
/*
lovhe novu b  INT
heyvanlarin sayi n INT
en boyuk mesafe d LONG LONG 
lohhenin olcusu m INT 
kordinatlar ---->A[i] B[i][i] C[i][i] INT 

*/
int b,n,m,i,j,say=0,s=0,d;
cin>>b>>n>>d>>m;
int A[n];
long long ferq [n*(n-1)/2];
if(b==1){
	for(i=0;i<n;i++) cin>>A[i];
    for(i=0;i<n;i++){
    	for(j=i+1;j<n;j++) {
    		ferq[s]=A[i]-A[j];
    		s++;
		}
	}
for(i=0;i<s;i++){
	ferq[i]=abs(ferq[i])
	 if(ferq[i]<=d) say++;
}
cout<<say;
}	
long long ferq1[n*(n-1)/2],ferq2[n*(n-1)/2],ferq3[n*(n-1)/2];
int r,t,Y[n],X[n],Z[n],q;
if(b==2){
	
	for(i=0;i<n;i++){
	cin>>r>>t;	
	Y[i]=r;
	X[i]=t;
	} 
    for(i=0;i<n;i++){
    	for(j=i+1;j<n;j++) {
    		ferq1[s]=X[i]-X[j];
		    ferq2[s]=Y[i]-Y[j];
    		s++;
		}
	}
for(i=0;i<s;i++) ferq[i]=abs(ferq1[i])+abs(ferq2[i]);

for(i=0;i<s;i++)	if(ferq[i]<=d) say++;
cout<<say;
}
/*
long long ferq1[n*(n-1)/2],ferq2[n*(n-1)/2];
int r,t,Y[n],X[n],q;
*/
if(b==3){
	for(i=0;i<n;i++){
	cin>>r>>t>>q;	
	Y[i]=r;
	X[i]=t;
	Z[i]=q;
	} 
    for(i=0;i<n;i++){
    	for(j=i+1;j<n;j++) {
    		ferq1[s]=X[i]-X[j];
		    ferq2[s]=Y[i]-Y[j];
		    ferq3[s]=Z[i]-Z[j];
    		s++;
		}
	}
for(i=0;i<s;i++) ferq[i]=abs(ferq1[i])+abs(ferq2[i])+abs(ferq3[i]);

for(i=0;i<s;i++)	if(ferq[i]<=d) say++;
cout<<say;
}


}

Compilation message

pairs.cpp: In function 'int main()':
pairs.cpp:27:22: error: expected ';' before 'if'
   27 |  ferq[i]=abs(ferq[i])
      |                      ^
      |                      ;
   28 |   if(ferq[i]<=d) say++;
      |   ~~