This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
/**
* 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... |