What is the Codeforces Round related to the football season?
- 内容介绍
- 文章标签
- 相关推荐
本文共计1097个文字,预计阅读时间需要5分钟。
足球赛季在贝尔兰刚刚结束。根据贝尔兰足球的规则,每场比赛都是由两队进行的。每场比赛的结果要么是平局,要么是其中一支球队的胜利。如果一支球队赢得了比赛……
The football season has just ended in Berland. According to the rules of Berland football, each match is played between two teams. The result of each match is either a draw, or a victory of one of the playing teams. If a team wins the match, it gets
The manager of the Berland capital team wants to summarize the results of the season, but, unfortunately, all information about the results of each match is lost. The manager only knows that the team has played
You have to determine three integers
The first line contains four integers
If there is no answer, print
Otherwise print three non-negative integers
x ⋅ w + y ⋅ d = p ">x⋅w+y⋅d=px⋅w+y⋅d=p,x + y + z = n ">x+y+z=nx+y+z=n.
30 60 3 1 output Copy
17 9 4 input Copy
10 51 5 4 output Copy
-1 input Copy
20 0 15 5 output Copy
0 0 20 Note
One of the possible answers in the first example —
In the second example the maximum possible score is
In the third example the team got
#include <bits/stdc++.h> using namespace std; #define ll long long #define TLE ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); ll m,n,l,r; int main() { TLE; while(cin>>n>>m>>l>>r) { for(int i=0;i<min(n,l);i++) { if(m-i*r<0) break; if( !((m-i*r)%l) ) { if(i+((m-i*r)/l) <=n ) { cout<<(m-i*r)/l<<" "<<i<<" "<<n-i-(m-i*r)/l<<endl; return 0; } } } cout<<-1<<endl; } return 0; }
本文共计1097个文字,预计阅读时间需要5分钟。
足球赛季在贝尔兰刚刚结束。根据贝尔兰足球的规则,每场比赛都是由两队进行的。每场比赛的结果要么是平局,要么是其中一支球队的胜利。如果一支球队赢得了比赛……
The football season has just ended in Berland. According to the rules of Berland football, each match is played between two teams. The result of each match is either a draw, or a victory of one of the playing teams. If a team wins the match, it gets
The manager of the Berland capital team wants to summarize the results of the season, but, unfortunately, all information about the results of each match is lost. The manager only knows that the team has played
You have to determine three integers
The first line contains four integers
If there is no answer, print
Otherwise print three non-negative integers
x ⋅ w + y ⋅ d = p ">x⋅w+y⋅d=px⋅w+y⋅d=p,x + y + z = n ">x+y+z=nx+y+z=n.
30 60 3 1 output Copy
17 9 4 input Copy
10 51 5 4 output Copy
-1 input Copy
20 0 15 5 output Copy
0 0 20 Note
One of the possible answers in the first example —
In the second example the maximum possible score is
In the third example the team got
#include <bits/stdc++.h> using namespace std; #define ll long long #define TLE ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); ll m,n,l,r; int main() { TLE; while(cin>>n>>m>>l>>r) { for(int i=0;i<min(n,l);i++) { if(m-i*r<0) break; if( !((m-i*r)%l) ) { if(i+((m-i*r)/l) <=n ) { cout<<(m-i*r)/l<<" "<<i<<" "<<n-i-(m-i*r)/l<<endl; return 0; } } } cout<<-1<<endl; } return 0; }

