Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
Register

## Re:我就搞不懂了 同一个代买 g++提交 tle c++提交a了？？？？

Posted by rigby_mky at 2020-08-14 22:59:56 on Problem 2976
In Reply To:Re:我就搞不懂了 同一个代买 g++提交 tle c++提交a了？？？？ Posted by:jianqiming at 2019-11-25 21:54:18
```> #include <iostream>
> #include<string>
> #include<vector>
> #include<algorithm>
> #include<cstring>
> #include<cmath>
> #include<map>
> #include<set>
> #include<queue>
> #include<cstdio>
> using namespace std;
> typedef long long ll;
> const ll inf = 0xfffffffff;
> int vis[6005], ne[200];
> double a[5005], b[5005], ans[5005];
> /*ll gcd(ll a, ll b)
> {
> 	return b ? gcd(b, a%b) : a;
> }
> int phi(int x) {
> 	int ans = x;
> 	for (int i = 2; i*i <= x; i++) {
> 		if (x % i == 0) {
> 			ans = ans / i * (i - 1);
> 			while (x % i == 0) x /= i;
> 		}
> 	}
> 	if (x > 1)
> 		ans = ans / x * (x - 1);
> 	return ans;
> }
> int is(int a)
> {
> 	if (a % 400 == 0 || a % 4 == 0 && a % 100 != 0)
> 		return 1;
> 	else return 0;
> }
> ll qu(ll a, ll b, ll c)
> {
> 	ll ans = 1;
> 	while (b)
> 	{
>
> 		if (b & 1)
> 			ans = (ans%c*a%c) % c;
> 		b >>= 1;
> 		a = (a%c*a%c) % c;
> 	}
> 	return ans % c;
> }
> void ge(string a)
> {
> 	int j = 0, k = -1;
> 	int n = a.size();
> 	memset(ne, 0, sizeof(ne));
> 	ne[0] = -1;
> 	while (j < n)
> 	{
>
> 		if (k == -1 || a[j] == a[k])
> 			ne[++j] = ++k;
> 		else k = ne[k];
> 	}
>
> }int kmp(string a, string b)
> {
> 	int j = 0, i = 0;
> 	ge(b);
> 	int m = a.size(); int n = b.size();
> 	while (i < m&&j < n)
> 	{
> 		if (b[j] == a[i] || j == -1)
> 			i++, j++;
> 		else j = ne[j];
>
> 	}
> 	if (j == n)
> 		return 1;
> 	else return 0;
>
> }*/
> double cmp(double a, double b)
> {
>
> 	return a > b;
> }
> int main()
> {
> 	 ios::sync_with_stdio(false);
> 	int m, n, c, t, k; string s;
> 	while (cin >> n >> k)
> 	{
> 		if (n == 0 && k == 0)
> 			break;
> 	for (int i = 0; i < n; i++)
> 			cin >> a[i];
> 		for (int i = 0; i < n; i++)
> 			cin >> b[i];
> 		double r = 1.0, l = 0;
> 	while(r-l>=1e-6)
> 	{double res = 0;
> 			double mid = (r + l) / 2;
> 			for (int i = 0; i < n; i++)
> 			{
> 				ans[i] = a[i] - mid * b[i];
> 			}
> 			sort(ans, ans + n,cmp);
> 			for (int i = 0; i < n - k; i++)
> 				res += ans[i];
> 			if (res >= 0)
> 				l = mid;
> 			else r = mid;
> 		}
>
> 		cout << (int)(r * 100 + 0.5) << endl;
>
> 	}
> 	return 0;
> }
```

Followed by: