从细微销售到销售经营葡京签到送彩金

Gym –
101522A

其一标题真的很难写,但剧情一点都不难写,因为她就在本人身边。

There are two popular formats for representing a date: day/month/year or month/day/year. For example, today can be
represented as 15/8/2017 or 8/15/2017.

1八虚岁参与工作到现今截至,8年,她直接在相同家公司做,若是总计她不在集团的时辰,那么除了正规的节日假期日的话,正是在婚假及产假,加起来不到6个月的时日脱岗过。所以,“坚定不移”这厮格,不容置疑。

Sometimes (like on today), using one way or another should pose no
confusion — it is immediately understood that the date is the 15th of
August. On other days, however, the two representations may be
interpreted as two different valid dates. For example, the 7th of August
may be misinterpreted as the 8th of July, since both can be represented
as 7/8/2017 (or 8/7/2017).

本人不记得她的学历了,因为后来的光明足以令人不会去想要问出身,我必然是从未学院学历的,大专都未曾。所以刚进公司,她做的地点是一线销售。业绩不是专门高超的那种,算中等偏上吧,记得笔者在试用期时正好逢3.15售货大会,她带作者去给客户送诚邀函,结果还没进客户的门,先被门口的大狗给吓着了……于是更坚毅了自个儿毫不做销售的狠心,当时应聘客服岗位,销售COO一心想让转换工作岗位做销售,还美其名曰为了抓实客服,更应该先做销售,于是本次见客户的经验,越发持之以恒了自己不要从事销售那几个职分。

We say a date (D, M, Y) is ambiguous if D/M/Y and M/D/Y, when both
interpreted in the day/month/year
format, are different valid dates. For example, (7, 8, 2017) and (8, 7,
2017) are ambiguous, while (15, 8, 2017) and (10, 10, 2017) are
not.

因为公司提升的较快,办公面积不够用,所以把销售部搬到了楼上,需求招聘3个售货前台,于是她转换工作岗位做了前台,归行政部管。因为他做过销售,所以知道销售职员每每那些打卡签到
拜访客户等等平常和行政考核发生争论,她熟稔各个情况,能站在销售的职位上提出实际难点,又能在行政的角度上提议实操方案,于是她给的提出获得了销售部和行政部一样通过顺遂执行,同时他更掌握销售面临的各类压力,常常举行各类活动为销售人士减压,让销售职员感受到后勤部门对前方销售的关心和支撑。在行政职务上他干的活跃,组织能力彰显。记不得她做了多长时间,又是商户在里面选择销售CEO,她被选上了。

The total number of ambiguous dates in the Gregorian calendar system on
any given year is equal to 12 × 11 = 132.

带了3个7位的行销团队,清一色的女兵,清一色的新人。小编见到过有人去她那里哭鼻子,也看出过在会议上他怎么手把手教他们分析客户,她逼着她们去主持公司的大晨会,逼着他俩在豪门前面显示才艺,逼着他们也是逼着和谐随后录像学习多少个全部的舞蹈节目。作者问她怎么要如此做,她说为了练她们的胆量,扩张她们的自信。作者说她们能明白你的难言之隐吗?她说起来不清楚,有啼哭的,有在下边偷偷骂她的,但是当她们由贰个看看不熟悉人话都不敢说,到今后二个个都成为销冠时,她认为有成就感。确实,到新兴,频仍的看来她们团队的分子,只怕他们团队,站在月度的领奖台上,个人月度销售亚军,团队月度销售季军……
再后来,客服部须要树立失效复活组,那是3个新的单位,领导决定让她来做这么些机构的首领员。

Now, suppose that in a hypothetical calendar system, there are M months, where the i-th
month has D[i] days, numbered from 1 to
D[i]. Assume that there are no leap
years.

新的单位只得用新人,所以他得从头培育,手把手的教,作育好出业绩了,生效部须求人,就得把人给生效部。可是每种月的功绩职分可不会因为把人输送出去而缩减一丢丢。

You are to carry out a calendar reform, by shuffling the array D[], and your target is to minimize the total
number of ambiguous dates in a calendar year. Specifically, you want to
find a permutation p[1], p[2], …, p[M] of integers 1, 2, …, M, such that the new calendar system,
where the i-th month has D[p[i]] days, has the minimal number of
ambiguous dates. Output that minimal
number.

可以吗以上甘休,她带的团伙人数不超过九位,大多数是新人,自身培育的。然后有一天,公司让她去管理销售部,叁个30多少人的部门,她任部门经理,上边有主持和轻微。她问小编说:平昔不曾管过如此三人,很不安,特别是团队里有老销售
有老主持……笔者说您把顾虑给经理娘说说,听听他的提出;停了有一天,她说COO说了成就三点
,就能管好共青团和少先队,分别是:一 、公平正义;2、不要假公济私;③ 、以身作则。她说她不懂,可是要尝试看。到眼下他做销售老板有两年多了吧,中间还生了娃。业绩做的很不利,日常突破在此之前的业绩记录。

Input

最终,她是自作者见过的,最理想的女销售经营。

The first line of input consists of a single integer M, the number of months in the hypothetical calendar
system.

The second line of input consists of M integers
D[1], D[2], …, D[M], the original
number of days in the i-th
month.

For all test cases, 1 ≤ M ≤ 105, 1 ≤ D[i] ≤ 105.

Output

Output a single integer, the minimal number of ambiguous dates after the
calendar reform.

Example

Input

12
31 28 31 30 31 30 31 31 30 31 30 31

Output

132

Input

3
5 1 1

Output

0

逻辑题,显然某个月份的天数越多,这个月就应该越靠后。
想通就很容易了,排个序就好了。

#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<stack>
#include<map>
#include<vector>
#include<set>
#include<queue>
using namespace std;
const int MAXN=1e5+10;
const double mod=1e16+7;
#define INF 0x7fffffff
#define ll long long
#define edl putchar('\n')
#define FOR(i,a,b) for(int i=a;i<=b;i++)
#define ROF(i,a,b) for(int i=a;i>=b;i--)
#define mst(a) memset(a,0,sizeof(a))
#define mstn(a,n) memset(a,n,sizeof(a))

int main()
{
    int n,a[MAXN];
    ll ans=0,sum;
    scanf("%d",&n);
    FOR(i,1,n)
    scanf("%d",&a[i]);
    sort(a+1,a+n+1);
    ans+=2*min(a[1]-1,n-1);
    FOR(i,2,n)
    {
        if(a[i]>i)
        ans+=2*min(a[i]-i,n-i);
    }
    printf("%lld\n",ans);
}

Gym –
101522C

To boost contestants’ performances in the 20th La Salle – Pui Ching Programming Challenge,
the organizers have bought N robots to cheer
for them. Each robot is supposed to display cheering slogans, letter by
letter.

Unfortunately, due to some technical reasons, the display screen of each
robot can only display one fixed character. Therefore, the organizers
decided to arrange the robots in a row, thus forming a string of N letters (What a waste!). All letters are in
uppercase.

The two hosting schools have abbreviated names LSC and PCMS,
as we all know. Which of the two names appear (as a substring) in the
string more often?

Input

The first and only line of input consists of a string with N uppercase letters.

For all test cases, N ≤ 100.

Output

Let A be the number of occurrences of LSC in the given string.

Let B be the number of occurrences of PCMS in the given string.

If A > B, output LSC.

If A < B, output PCMS.

If A = B, output Tie.

 签到题,直接暴力就好了,然则作者被卡了弹指间,就像是本人的编写翻译系统和评测系统不相同。

举个例证for(int
i=1;i<1;i++)在自身那不会议及展览开演算,在测验评定那里就招致访问越界了。

#include<bits/stdc++.h>
using namespace std;
#define INF 0x7fffffff
#define ll long long
#define edl putchar('\n')
#define useit  ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define FOR(i,a,b) for(int i=a;i<=b;i++)
#define ROF(i,a,b) for(int i=a;i>=b;i--)
#define mst(a) memset(a,0,sizeof(a))
#define mstn(a,n) memset(a,n,sizeof(a))
 
int main()
{
    string s;
    cin>>s;
    int l1=0,l2=0;
    if(s.length()>1)
    FOR(i,2,s.length()-1)
    {
        //cout<<s[i-2]<<s[i-1]<<s[i]<<endl;
        if(s[i-2]=='L'&&s[i-1]=='S'&&s[i]=='C')
        l1++;
    }
    if(s.length()>2)
    FOR(i,3,s.length()-1)
    {
        //cout<<s[i-3]<<s[i-2]<<s[i-1]<<s[i]<<endl;
        if(s[i-3]=='P'&&s[i-2]=='C'&&s[i-1]=='M'&&s[i]=='S')
        l2++;
    }
    if(l1>l2)
    cout<<"LSC"<<endl;
    else if(l1<l2)
    cout<<"PCMS"<<endl;
    else
    cout<<"Tie"<<endl; 
}

 

 

  Gym –
101522D 
                   

 

The Gregorian calendar is internationally the most widely used civil
calendar. It is named after Pope Gregory XIII, who introduced it in
October 1582.

In the Gregorian calendar, there are 28 days in
February in a common year and 29 days in February
in a leap year. Year Y is a leap year if and
only if Y is a multiple of 400, or Y is a multiple of
4 and is not a multiple of 100.

Percy is curious about the distribution of days of the week of his
birthday in his life. By checking the calendar, he quickly finds that in
the years between 1999 and 2017 (inclusive), his birthday (in case you do not
know, 27 February) appears only twice on both Tuesday and Thursday,
three times on each of the other days of the week.

Percy finds counting the distribution of some days in some consecutive
years really cool, so he decides to invent a way to quickly count the
distribution.

Within 15 minutes, he successfully invented a fast program to do the
calculation for years between 1583 and 2 × 109, inclusive. His program can
answer 5000 queries in 1
second. However, he is not sure if the program works correctly, so he
needs your help. Your task is simple, write your own program to do the
calculation, so that Percy can check his program’s correctness by
comparing the outputs of different queries with your
program.

In this problem, please assume the definition of leap years mentioned
above is true for all years between 1583 and
2 × 109, inclusive.

Input

The first line consists of a single integer, Q,
denotes the number of queries. (1 ≤ Q ≤ 5000)

In the next Q lines, each describes a single
query. The queries are in the format S E
M D, which means you have to calculate the distribution of days of the
week for the D-th day of the M-th month for all years between S and E, inclusive. (1583 ≤ S ≤ E ≤ 2 × 109, the days given are one of the
366 valid
days)

Output

Output Q lines, each answers a query
given.

In each line output 7 integers, the frequencies of days of the weeks in
this order: Sunday, Monday, Tuesday, Wednesday, Thursday, Friday,
Saturday.

The order of answers should follow the order of queries given.

Example

Input

1
1999 2017 2 27

Output

3 3 2 3 2 3 3

Input

2
2017 2017 8 15
2017 2021 2 29

Output

0 0 1 0 0 0 0
0 0 0 0 0 0 1

Input

4
3141 5926 5 3
5897 9323 8 4
2718 2818 2 8
2222 2222 2 22

Output

404 391 403 390 404 396 398
488 488 497 481 497 480 496
15 14 14 15 14 15 14
0 0 0 0 0 1 0

日期模拟,发现400年为一个完整的循环(日期星期闰年状态相同),然后要预处理,建议用一个三维数组存情况,这样子写代码会很轻松。

#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<stack>
#include<map>
#include<vector>
#include<set>
#include<queue>
using namespace std;
const int MAXN=1e5+10;
const double mod=1e16+7;
#define INF 0x7fffffff
#define ll long long
#define edl putchar('\n')
#define FOR(i,a,b) for(int i=a;i<=b;i++)
#define ROF(i,a,b) for(int i=a;i>=b;i--)
#define mst(a) memset(a,0,sizeof(a))
#define mstn(a,n) memset(a,n,sizeof(a))
int isr(int n)
{
    if(n%4==0&&n%100!=0||n%400==0)return 1;
    else return 0;
}
int da[810][15][35];
//20871
void init()
{
    int k[15],l=6;
    k[1]=31,k[2]=28,k[3]=31,k[4]=30,k[5]=31,k[6]=30;
    k[7]=31,k[8]=31,k[9]=30,k[10]=31,k[11]=30,k[12]=31;
    mst(da);
    FOR(i,0,399)
    {
        FOR(j,1,12)
        {
            if(j==2)
            FOR(t,1,k[j]+isr(i))
            {
                if(l+1==8)l=0;
                da[i][j][t]=++l,da[i+400][j][t]=l;
            }
            else
            FOR(t,1,k[j])
            {
                if(l+1==8)l=0;
                da[i][j][t]=++l,da[i+400][j][t]=l;
            }
        }
    }
}

int main()
{
    int q,y1,y2,m,d,t;
    ll s[10];
    cin>>q;
    init();
    while(q--)
    {
        mst(s);
        scanf("%d%d%d%d",&y1,&y2,&m,&d);
        if(y2-y1>=400)
        {
            t=(y2-y1)/400;
            FOR(i,y1%400,y1%400+399)
            s[da[i][m][d]]+=t;
        }
        y1%=400,y2%=400;
        if(y1>y2) y2+=400;
        FOR(i,y1,y2)
        {
            s[da[i][m][d]]++;
        }
        FOR(i,1,7)
        cout<<s[i]<<" ";
        edl;
    }
}

Gym –
101522H 
                   

 

“Hit!” is a popular game in ancient Byteland.

The very first version of the game is quite simple: each player picks up
a stone and throws it at a circle drawn on the ground. A player wins if
his/her stone lands inside the circle.

After 20 years of practice, Bitman, a young man living in ancient
Byteland, has mastered the skill of throwing stones – he can throw a
stone at any specific place he wants. With such skill, Bitman plays
“Hit!” without losing a single game. He simply targets every stone at
the center of the circle!

The King of Hackerland hears the story of Bitman and wants to challenge
him with a harder, though still very simple, version of “Hit!”.

In each game, two circles which share a positive common area are drawn
on the ground. In order to win, the player must throw a stone at the
common area of the two circles.

As Bitman had no idea how to target his stone at the common area, he
asks for your help. Given the coordinates of the centers and radii of
the two circles, please tell Bitman the coordinates of any point he can
target at such that he can win the game.

For simplicity, you can consider the landing position of the stone as a
single point.

Input

The input consists of two lines, each describes one circle drawn on the
ground. Each line contains three integers x, y and r, denoting
respectively the x-coordinate, y-coordinate, and the radius of a circle.

All coordinates have their absolute value no more than 100, and 1 ≤ r ≤ 100 for both
circles.

Output

Output two numbers, the x-coordinate and y-coordinate of a point where Bitman can throw his
stone at to win the game.

Your answer will be accepted if for each of the two circles, the point
lies inside the circle or that the distance between the point and the
circle is not greater than 10 - 5.

Example

Input

0 0 3
3 4 3

Output

1.5 2.5

Input

-7 -9 3
-4 -4 5

Output

-6 -7

Note

In the first sample, (1.5, 2.5) is a possible
answer as it lies inside the common area of two circles drawn. Please
note that there exists more than one possible answer in this case. For
example, (2, 2), (1, 2)
and (2.1, 1.87) are also possible
answers.

 

实际上题材对于精度没有很高的须要,求出圆心连线与四个圆的交点,再出口那三个点的中间就能满意精度需要,但那题有个坑点,假使连线不与圆相交就会出错,须求特判

#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<stack>
#include<map>
#include<vector>
#include<set>
#include<queue>
using namespace std;
const int MAXN=1e5+10;
const double eps=1e-6;
#define INF 0x7fffffff
#define ll long long
#define edl putchar('\n')
#define FOR(i,a,b) for(int i=a;i<=b;i++)
#define ROF(i,a,b) for(int i=a;i>=b;i--)
#define mst(a) memset(a,0,sizeof(a))
#define mstn(a,n) memset(a,n,sizeof(a))
struct point 
{
    double x,y;
    point() {}
    point(double _a,double _b)
    {
        x=_a;
        y=_b;
    }
};

double distan(point p1,point p2)
{
    return sqrt((p1.x-p2.x)*(p1.x-p2.x)+(p1.y-p2.y)*(p1.y-p2.y));
}

double dist(point p1,point p2)
{
    return (p1.x-p2.x)*(p1.x-p2.x)+(p1.y-p2.y)*(p1.y-p2.y);
}


int main()
{
    point a,b,c,d,e;
    double r1,r2,l,s;
    cin>>a.x>>a.y>>r1>>b.x>>b.y>>r2;
    l=distan(a,b);
    if(l<r1||l<r2)
    {
        if(l<r1)
        cout<<b.x<<" "<<b.y<<endl;
        else if(l<r2)
        cout<<a.x<<" "<<a.y<<endl;
    }
    else
    {
        s=l-r2;
        c.x=a.x*l-(a.x-b.x)*s;
        c.y=a.y*l-(a.y-b.y)*s;
        s=l-r1;
        d.x=b.x*l-(b.x-a.x)*s;
        d.y=b.y*l-(b.y-a.y)*s;
        e.x=(c.x+d.x)/2/l;
        e.y=(c.y+d.y)/2/l;
        /*while(dist(a,e)>r1*r1)
        {
            e.x+=(b.x-a.x)*eps;
        }
        while(dist(b,e)>r2*r2)
        {
            e.x-=(b.x-a.x)*eps;
        }*/
        cout<<e.x<<" "<<e.y<<endl;
    }

Gym –
101522I

Arya lives in a magical world. You can view it as a number line.

There are N citizens in total. The i-th citizen have his own house in position i with height H*i*, Noted that H*i* could be non positive, which
means their house is actually built beneath the
horizon.

Arya is the hand of the king and she thinks that the buildings are a bit
out of order. She denote the chaos index of the world as
葡京签到送彩金 1.

Noted that h*i* could be equal to zero as the
world is magical.

She feels that the current chaos index of the world is too high. So she
designs to change the world a bit by using her super power.

She could flip a continuous sequence of building, i.e., she could choose
two arbitrary integer L and R, where 1 ≤ L ≤ R ≤ N,
and invert the signs of H*i* for all L ≤ i ≤ R (positive to negative and vice
versa).

As Arya is weak, she would only do this operation exactly once. Arya
wants to minimize the chaos index after the operation. Being a good guy,
help Arya to find the lowest possible chaos index after exactly flipping
one continuous sequence of building.

Input

The first line contains an integer N. (1 ≤ N ≤ 106)

The second line consist of N integers, the
i-th integer is H*i*. ( - 109 ≤ H*i* ≤ 109)

Output

Output consist only one integer in a single line, the lowest possible
chaos index after exactly flipping one continuous sequence of building.

Example

Input

4
1 -2 -3 4

Output

3

Input

5
-3 -2 0 -5 3

Output

10

Note

In the first sample, Arya should flip house 2 to 3, so that the heights
become 1, 2, 3, 4 and the chaos index would be
|2 - 1| + |3 - 2| + |4 - 3| = 3.

|x - y| is the absolute difference between
x and y.

逻辑题,当您发现到选取二个距离只会对多少个点产生震慑时,答案就很明朗了。

#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<stack>
#include<map>
#include<vector>
#include<set>
#include<queue>
using namespace std;
const int MAXN=1e6+10;
const double mod=1e16+7;
#define INF 0x7fffffff
#define ll long long
#define edl putchar('\n')
#define FOR(i,a,b) for(int i=a;i<=b;i++)
#define ROF(i,a,b) for(int i=a;i>=b;i--)
#define mst(a) memset(a,0,sizeof(a))
#define mstn(a,n) memset(a,n,sizeof(a))
int n,a[MAXN],l1=0,l2=0,s1=0,s2=0,k;
int main()
{
    ll ans=0;
    scanf("%d%d",&n,&a[1]);
    FOR(i,2,n)
    {
        scanf("%d",&a[i]);
        ans+=abs(a[i]-a[i-1]);
        if(a[i]>0&&a[i-1]<0||a[i]<0&&a[i-1]>0)
        {
            if(l1==0)
            {
                l1=i;
                s1=2*min(abs(a[i]),abs(a[i-1]));
            }
            else
            {
                if(l2==0)
                {
                    l2=i;
                    s2=2*min(abs(a[i]),abs(a[i-1]));
                    if(s2>s1)
                    swap(l1,l2),swap(s1,s2);
                }
                else
                {
                    k=2*min(abs(a[i]),abs(a[i-1]));
                    if(k>s1)
                    l2=l1,s2=s1,l1=i,s1=k;
                    else if(k>s2)
                    l2=i,s2=k;
                }
            }
        }
    }
    printf("%lld\n",ans-s1-s2);
}

 

Gym –
101522K 
                   

The King of Byteland owns an army of well-trained knights. One day, he
decides to attack Hackerland. Hackerland can be described as a grid with
N rows and M columns.
The cell on the i-th row, j-th column is called cell (i, j) for convenience. The north-west corner is
(1, 1) while the south-east corner is (N, M).

In order to win, the Byteland army must occupy all cells with knights.
Now, the King of Byteland has carefully planned the attack. The attack
can be divided into two phases.

In the first phase, a number of knights are sent to some specific cells
of Hackerland.

After the first phase has ended, the second phase begins. In the second
phase, The knights will start attacking the land of Hackerland. Their
only way to attack is as follows: If at any moment, there are two
knights on the same row or the same column, then all unoccupied cells
between the two knights will be under attack, and more knights will be
immediately sent to occupy these cells. This phase will end when no more
cells can be occupied.

Please note that the knights are not allowed to move once they are sent
to Hackerland.

In the following graph, the cells (2, 7), (4, 3), (5, 7) and (8, 3) are occupied in the first phase.

葡京签到送彩金 2

When the second phase starts, the cells between (4, 3) and (8, 3), (2, 7) and (5, 7) are under
attack, and then occupied by other knights. Afterwards, the cells
between (4, 3) and (4, 7),
(5, 3) and (5, 7) will
also be occupied. The second phase will end after this as no more cells
can be occupied.

The attack is currently in the first phase. K
cells of Hackerland are already occupied under the command of the King.
You, the leader of the knights, are going to send some more knights
(possibly none) to some cells of Hackerland of your choice before the
second phase starts.

On one hand, you have to send enough knights to ensure that at the end
of the war, all cells are occupied. On the other hand, you have to send
as few knights as possible to minimize the chance of being discovered by
the army of Hackerland. Your task is to find out the minimum number of
knights to be sent.

Input

The first line contains three integers: N,
M and K. (1 ≤ N, M ≤ 100, 0 ≤ K ≤ N·M)

The next K lines each contains two integers:
x and y, which means a
knight was sent by the King to occupy cell (x, y). (1 ≤ x ≤ N, 1 ≤ y ≤ M)

No any two knights are sent to the same cell.

Output

Output an integer, the minimum number of extra knights to be sent, on a
single line.

Example

Input

1 1 0

Output

1

Input

2 2 0

Output

4

Input

3 3 8
1 1
1 2
1 3
2 1
2 3
3 1
3 2
3 3

Output

0

逻辑题,如果玩过黑白棋就知道四个角是什么地位了,其他的位置不会干扰到角。

#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<stack>
#include<map>
#include<vector>
#include<set>
#include<queue>
using namespace std;
const int MAXN=1e5+10;
const double mod=1e16+7;
#define INF 0x7fffffff
#define ll long long
#define edl putchar('\n')
#define FOR(i,a,b) for(int i=a;i<=b;i++)
#define ROF(i,a,b) for(int i=a;i>=b;i--)
#define mst(a) memset(a,0,sizeof(a))
#define mstn(a,n) memset(a,n,sizeof(a))

int main()
{
    int n,m,k,ans,a,b;
    scanf("%d%d%d",&n,&m,&k);
    if(n==1||m==1)
    {
        if(n==m)ans=1;
        else ans=2;
        if(n==1)
        FOR(i,1,k)
        {
            scanf("%d%d",&a,&b);
            if(b==1||b==m)ans--;
        }
        else if(m==1)
        FOR(i,1,k)
        {
            scanf("%d%d",&a,&b);
            if(a==1||a==n)ans--;
        }
    }
    else
    {
        ans=4;
        FOR(i,1,k)
        {
            scanf("%d%d",&a,&b);
            if(a==1&&b==m||a==1&&b==1||a==n&&b==1||a==n&&b==m)ans--;
        }

    }
    printf("%d\n",ans);

}