A. Key races
题目链接
Two boys decided to compete in text typing on the site “Key races”. During the competition, they have to type a text consisting of s characters. The first participant types one character in v1 milliseconds and has ping t1 milliseconds. The second participant types one character in v2 milliseconds and has ping t2 milliseconds.

If connection ping (delay) is t milliseconds, the competition passes for a participant as follows:

Exactly after t milliseconds after the start of the competition the participant receives the text to be entered.
Right after that he starts to type it.
Exactly t milliseconds after he ends typing all the text, the site receives information about it.
The winner is the participant whose information on the success comes earlier. If the information comes from both participants at the same time, it is considered that there is a draw.

Given the length of the text and the information about participants, determine the result of the game.

Input
The first line contains five integers s, v1, v2, t1, t2 (1 ≤ s, v1, v2, t1, t2 ≤ 1000) — the number of characters in the text, the time of typing one character for the first participant, the time of typing one character for the the second participant, the ping of the first participant and the ping of the second participant.

Output
If the first participant wins, print “First”. If the second participant wins, print “Second”. In case of a draw print “Friendship”.

Examples
input
5 1 2 1 2
output
First
input
3 3 1 1 1
output
Second
input
4 5 3 1 5
output
Friendship
Note
In the first example, information on the success of the first participant comes in 7 milliseconds, of the second participant — in 14 milliseconds. So, the first wins.

In the second example, information on the success of the first participant comes in 11 milliseconds, of the second participant — in 5 milliseconds. So, the second wins.

In the third example, information on the success of the first participant comes in 22 milliseconds, of the second participant — in 22 milliseconds. So, it is be a draw.

#include<iostream>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<cstdio>
using namespace std;
const int MM=1e3+5;
int t;
int s,v1,v2,t1,t2;
int main()
{
    scanf("%d %d %d %d %d",&s,&v1,&v2,&t1,&t2);
    int sum1=t1+s*v1+t1;
    int sum2=t2+s*v2+t2;
    if(sum1==sum2)
        printf("Friendship\n");
    else if(sum1<sum2)
        printf("First\n");
    else if(sum1>sum2)
        printf("Second\n");
    return 0;
}

B. The number on the board
题目链接
Some natural number was written on the board. Its sum of digits was not less than k. But you were distracted a bit, and someone changed this number to n, replacing some digits with others. It’s known that the length of the number didn’t change.

You have to find the minimum number of digits in which these two numbers can differ.

Input
The first line contains integer k (1 ≤ k ≤ 109).
The second line contains integer n (1 ≤ n < 10100000).
There are no leading zeros in n. It’s guaranteed that this situation is possible.

Output
Print the minimum number of digits in which the initial number and n can differ.
Examples
input
3
11
output
1
input
3
99
output
0
Note
In the first example, the initial number could be 12.
In the second example the sum of the digits of n is not less than k. The initial number could be equal to n.

**题意:**先给k一个常数;再给一个常数n,问题是算出n的位数的和sum 然后与k的值进行比较,如果小于k则需要改变n的位数的值 问你需要改多少次可以使得sum 大于k;
**解题思路:**很简单先把所以的位数求出,再贪心,贪心的策略是每一次改变位数我都用最大的(即9 来所以位数的最小的值,那么我就能用最少的次数使得sum大于k了;

#include<iostream>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<cstdio>
#define ll long long
using namespace std;
const int MM=1e6+5;
int t;
char s[MM];
ll a[MM];
ll sum=0;
int main()
{
    scanf("%d",&t);
    getchar();
    scanf("%s",s);//数据很大用字符数组存
    int len=strlen(s);
    int l=0;
    for(int i=0;i<len;i++)
    {
        a[l++]=s[i]-'0';//记录每一个位数的值
        sum+=s[i]-'0';//位数之和;
    }
    sort(a,a+l);//排序一下
    if(sum<t)
    {
        int k=0;
        while(sum<t)
        {
            sum+=9;//贪心
            sum-=a[k];
            k++;
        }
        printf("%d\n",k);
    }
    else
        printf("0\n");
    return 0;
}