이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
/**
* user: wald-f11
* fname: Almog
* lname: Wald
* task: devil
* score: 29.0
* date: 2019-10-10 07:34:22.510782
*/
//============================================================================
// Name : addition.cpp
// Author :
// Version :
// Copyright : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================
#include <iostream>
#include <math.h>
#include <vector>
#include <set>
#include <map>
#include <utility>
//#include "euclid.h"
typedef long long lol;
#define into(b) cin >> b;
#define deft(a,b) a b; into(b);
#define def(b) deft(lol,b)
#define co cout <<
#define el << endl;
#define ell << '\n';
#define ld long double
#define forr(i,a,b,c) for(int i=a;i<b;i+=c)
#define fort(i,a,b) forr(i,a,b,1)
#define fortb(i,a,b) for(int i=b-1;i>=a;i--)
#define forn(i,b) fort(i,1,b)
#define fornb(i,b) fortb(i,1,b)
#define fori(i,b) fort(i,0,b)
#define forib(i,b) fortb(i,0,b)
#define maxi 1000000007
#define mod %maxi
#define con continue;
#define br break;
#define wne(arr) while(!arr.empty())
using namespace std;
typedef vector<int> veci;
typedef vector<lol> vecl;
typedef pair<lol,lol> point;
typedef vector<point> vecp;
lol tri(lol a){
return (a*(a+1))/2;
}
lol modinverse(lol a,lol m){
lol x=1;
lol y=0, b=m;
while(a!=1){
lol num=b/a;
b-=num*a;
y-=num*x;
swap(a,b);
swap(x,y);
}
x= x%m;
if(x<0){
x+=m;
}
return x;
}
int main() {
ios::sync_with_stdio(false);
def(t)
fori(kkk,t){
def(k)
veci a(9);
int sum=0;
fori(i,9){
into(a[i])
sum+=a[i];
}
veci b(sum);
if(a[1]<k){
fort(i,sum-a[1],sum){
b[i]=1;
}
}else{
fort(i,sum-k+1,sum){
b[i]=1;
}
a[1]-=k-1;
ld x=(a[0]*1.0)/(a[0]+a[1])+0.000000000001;
ld cur=0;
fori(i,sum-k+1){
if(((int)(cur+x))-((int) cur) ==0){
b[i]=1;
}
cur+=x;
}
}
fori(i,sum){
co b[i]+1;
}
co "" ell
}
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |