結果
| 問題 | No.550 夏休みの思い出(1) |
| コンテスト | |
| ユーザー |
btk
|
| 提出日時 | 2017-04-05 23:58:30 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,471 bytes |
| 記録 | |
| コンパイル時間 | 1,900 ms |
| コンパイル使用メモリ | 173,044 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-07-16 03:37:53 |
| 合計ジャッジ時間 | 3,999 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 52 WA * 3 |
コンパイルメッセージ
main.cpp: In function 'LL getone(INT, INT, INT)':
main.cpp:37:1: warning: control reaches end of non-void function [-Wreturn-type]
37 | }
| ^
ソースコード
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
#define CIN_ONLY if(1)
struct cww{cww(){
CIN_ONLY{
ios::sync_with_stdio(false);cin.tie(0);
}
}}star;
#define fin "\n"
#define FOR(i,bg,ed) for(int i=(bg);i<(ed);i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
#define fi first
#define se second
#define pb push_back
#define DEBUG if(0)
#define REC(ret, ...) std::function<ret (__VA_ARGS__)>
template <typename T>inline bool chmin(T &l,T r)
{bool a=l>r;if(a)l=r;return a;}
template <typename T>inline bool chmax(T &l,T r)
{bool a=l<r;if(a)l=r;return a;}
template <typename T>
istream& operator>>(istream &is,vector<T> &v){
for(auto &it:v)is>>it;
return is;
}
typedef __int128 INT;
INT one=1;
LL getone(INT a,INT b,INT c){
FOR(i,-1123456,1123456){
INT sum=one*i*i*i+a*i*i+b*i+c;
if(sum==0)return i;
}
}
LL square_root(INT XX){
LL ok=0,ng=1e9+1;
while(ng-ok>1){
LL mid=(ok+ng)/2;
if(one*mid*mid<=XX)ok=mid;
else ng=mid;
}
return ok;
}
int main(){
LL A,B,C;
//xxx+Axx+Bx+C==0
cin>>A>>B>>C;
vector<LL> res;
res.pb(getone(A,B,C));
//(x-res[0])(xx+Ax+B)==0
A+=res[0];
B+=A*res[0];
//x=(-A+-sqrt(AA-4B))/2
{
LL sq=square_root(one*A*A-4*B);
res.pb((-A+sq)/2);
res.pb((-A-sq)/2);
}
sort(ALL(res));
cout<<res[0]<<" "<<res[1]<<" "<<res[2]<<endl;
return 0;
}
btk