QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#635573#6812. Draw a trianglesazhiCompile Error//C++201.5kb2024-10-12 20:12:342024-10-12 20:12:35

Judging History

你现在查看的是最新测评结果

  • [2024-10-12 20:12:35]
  • 评测
  • [2024-10-12 20:12:34]
  • 提交

answer

// author:  jieda
// file:	cpp
//#pragma GCC optimize("O3")
#include<bits/stdc++.h>
using namespace std;
# define fi first
# define se second
# define all(x) x.begin(),x.end()
# define stst stringstream
# define pb push_back
# define pf push_front
# define pp push
# define lowbit(x) (x)&(-x)
# define fa(i,op,n) for (int i = op; i <= n; i++)
# define fb(j,op,n) for (ll j = op; j >= n; j--)
# define fg(i,op,n) for (ll i = op; i != n; i = ne[i])
int dx[4] = {-1,0,1,0},dy[4] = {0,1,0,-1};
typedef unsigned long long  ull;
typedef long long ll;
typedef pair<ll,ll> Pll;
typedef pair<int,int> PII;
typedef pair<double,double> PDD;
const int N = 599999,INF = 0x3f3f3f3f,mod = 1000000007;
const ll MOD = 212370440130137957ll;//hash(hight)
const int base = 131;
const double eps = 1e-10;
const int seed=10086,mo=1e6+7; //hash(lower)
int prime = 233317;
using namespace std;
ll exgcd(ll a,ll b,ll &x,ll &y)
{
    if(!b) 
    {
        x = 1,y = 0;
        return a;
    }
    ll d = exgcd(b,a%b,y,x);
    y-=a/b*x;a
    return d;
}
void solve(){
	ll x2,y2,x3,y3;cin>>x2>>y2>>x3>>y3;
	ll x,y;
	if(x3-x2==0||(y3-y2) == 0){
		if(x3-x2 == 0){
			cout<<x2+1<<' '<<y2<<'\n';
		}else{
			cout<<x2<<' '<<y2+1<<'\n';
		}
	}else{
		ll d = exgcd(-(y3-y2),x3-x2,x,y);
		cout<<x+x2<<' '<<y+y2<<'\n';
	}
	return ;
}

int main()
{
	ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
	int t = 1;
	cin>>t;
	while(t--){
		solve();
	}
	return 0;
}
/*
二维向量的叉积:
*/

详细

answer.code: In function ‘ll exgcd(ll, ll, ll&, ll&)’:
answer.code:38:15: error: expected ‘;’ before ‘return’
   38 |     y-=a/b*x;a
      |               ^
      |               ;
   39 |     return d;
      |     ~~~~~~     
answer.code:38:6: warning: control reaches end of non-void function [-Wreturn-type]
   38 |     y-=a/b*x;a
      |     ~^~~~~~~