精华内容
下载资源
问答
  • ACM竞赛试题

    2012-07-24 08:57:19
    ACM竞赛试题
  • ACM竞赛题目简介ACM竞赛题目简介ACM竞赛题目简介ACM竞赛题目简介
  • ACM竞赛试题.PDF

    2020-12-02 15:00:15
    该资源为河南省某次ACM的竞赛试题,难度适中,可供出入ACM者练习,提前熟悉ACM试题,以便在ACM竞赛中取得满意的成绩
  • acm竞赛试题大全

    2018-03-31 16:43:53
    acm 试题大全,包括各大高校答题模版,acm竞赛必备良药
  • 郑州大学2011年3月校内选拔赛所用的ACM竞赛题目及答案 ACM竞赛题目及答案
  • acm竞赛试题.rar

    2008-07-05 10:57:57
    acm竞赛试题.rar
  • ACM Thank you for my ACM journey,That taught me a lot. I'm stupid but i'm hardworking. I have organized the good topics and ideas I have done into this project. I not only hope that I can come to ...
  • acm竞赛试题 ACM资料

    2011-07-20 08:28:45
    ACM必须掌握的算法, ACM大赛资料, ACM试题
  • 北京大学ACM竞赛试题

    2008-07-29 11:18:14
    北京大学ACM竞赛试题集锦,希望对你的编程能力因为它而更上一层楼,它的算法设计方面很有帮助对你
  • 关于一些初级ACM竞赛题目的分析和题解(九) 一些逻辑题目,见下题: A. Kefa and First Steps time limit per test 2 seconds memory limit per test 256 megabytes input standard input ...

                                                  关于一些初级ACM竞赛题目的分析和题解(九)

    一些逻辑题目,见下题:

    A. Kefa and First Steps
    time limit per test
    2 seconds
    memory limit per test
    256 megabytes
    input
    standard input
    output
    standard output

    Kefa decided to make some money doing business on the Internet for exactly n days. He knows that on the i-th day (1 ≤ i ≤ n) he makes ai money. Kefa loves progress, that's why he wants to know the length of the maximum non-decreasing subsegment in sequence ai. Let us remind you that the subsegment of the sequence is its continuous fragment. A subsegment of numbers is called non-decreasing if all numbers in it follow in the non-decreasing order.

    Help Kefa cope with this task!

    Input

    The first line contains integer n (1 ≤ n ≤ 105).

    The second line contains n integers a1,  a2,  ...,  an (1 ≤ ai ≤ 109).

    Output

    Print a single integer — the length of the maximum non-decreasing subsegment of sequence a.

    Examples
    input
    6
    2 2 1 3 4 1
    
    output
    3
    input
    3
    2 2 9
    
    output
    3
    Note

    In the first test the maximum non-decreasing subsegment is the numbers from the third to the fifth one.

    In the second test the maximum non-decreasing subsegment is the numbers from the first to the third one.

    Kefa决定在互联网上做一些钱,正好n天。 他知道在第i天(1≤i≤n),他赚了钱。 Kefa喜欢进步,这就是为什么他想知道序列ai中最大非递减子段的长度。 让我们提醒你,序列的子段是它的连续片段。 如果数字中的所有数字都是非递减的,则数字的一个子段称为非递减。

    在第一个测试中,最大的非递减子段是从第三个到第五个的数字。
    在第二个测试中,最大的非递减子段是从第一个到第三个的数字。

    using namespace std;
    typedef long long ll;
    int a,b,c,n,s[100001];
    int main()
    {
        cin>>n;
        for (int i=0;i<n;i++)
            {
                cin>>s[i];
            }
               for (int i=0;i<n;i++)
                {if(s[i]>=s[i-1])a++;  //找到非递减序列
                else (b=max(a,b),a=1);}// 不断寻找最大非递减序列的长度
    
        b=max(a,b);
        printf("%d",b);
    
    }
    

    A. Calculating Function
    time limit per test
    1 second
    memory limit per test
    256 megabytes
    input
    standard input
    output
    standard output

    For a positive integer n let's define a function f:

    f(n) =  - 1 + 2 - 3 + .. + ( - 1)nn

    Your task is to calculate f(n) for a given integer n.

    Input

    The single line contains the positive integer n (1 ≤ n ≤ 1015).

    Output

    Print f(n) in a single line.

    Examples
    input
    4
    
    output
    2
    
    input
    5
    
    output
    -3
    
    Note

    f(4) =  - 1 + 2 - 3 + 4 = 2

    f(5) =  - 1 + 2 - 3 + 4 - 5 =  - 3

    知道题做的时候脑袋傻了,明明是高中知识我还给整的超时了,下面是代码:
    #include<bits/stdc++.h>
    using namespace std;
    typedef long long ll;
    ll a,b,c,d,e,n;
    int main()
    {
        scanf("%lld",&n);
        if(n%2==0)
            printf("%lld",n/2);
        if(n%2!=0)
            printf("%lld",(-1-n)/2);
    
    }

    是一个分奇偶的等差数列,分清题意就好了,






    展开全文
  • 关于一些初级ACM竞赛题目的分析和题解(八)  下面两道题只是表面上复杂些而已,其实比较简单,上题: A. Beautiful Year time limit per test 2 seconds memory limit per test 256...
    关于一些初级ACM竞赛题目的分析和题解(八) 
    下面两道题只是表面上复杂些而已,其实 比较简单,上题:
    A. Beautiful Year
    time limit per test
    2 seconds
    memory limit per test
    256 megabytes
    input
    standard input
    output
    standard output

    It seems like the year of 2013 came only yesterday. Do you know a curious fact? The year of 2013 is the first year after the old 1987 with only distinct digits.

    Now you are suggested to solve the following problem: given a year number, find the minimum year number which is strictly larger than the given one and has only distinct digits.

    Input

    The single line contains integer y (1000 ≤ y ≤ 9000) — the year number.

    Output

    Print a single integer — the minimum year number that is strictly larger than y and all it's digits are distinct. It is guaranteed that the answer exists.

    Examples
    input
    1987
    
    output
    2013
    
    input
    2013
    
    output
    2014
    

    输入n(n大于等于1000,小于等于9000,且n的个十百千位各不相同),找出比n大的并个十百千位也不同的数;
    下面是代码:
    #include<bits/stdc++.h>
    using namespace std;
    typedef long long ll;
    int main()
    {
        int a,b,c,d,e,n;
        scanf("%d",&n);
        while (n<=10000)
        {
    n++;
            a=n%10;b=n%100/10;c=n/1000;d=n%1000/100;  // 确定个十百千位
            if (a!=b&&a!=c&&a!=d&&b!=c&&b!=d&&c!=d)  //  判断各位不同
            {  
            return 0*printf("%d",n);}
    
        }
    }
    重点是怎么找出个十百千的数,找到就好了,

    A. Nearly Lucky Number
    time limit per test
    2 seconds
    memory limit per test
    256 megabytes
    input
    standard input
    output
    standard output

    Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 477444 are lucky and 517467 are not.

    Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky digits in it is a lucky number. He wonders whether number n is a nearly lucky number.

    Input

    The only line contains an integer n (1 ≤ n ≤ 1018).

    Please do not use the %lld specificator to read or write 64-bit numbers in С++. It is preferred to use the cin, cout streams or the %I64d specificator.

    Output

    Print on the single line "YES" if n is a nearly lucky number. Otherwise, print "NO" (without the quotes).

    Examples
    input
    40047
    
    output
    NO
    
    input
    7747774
    
    output
    YES
    
    input
    1000000000000000000
    
    output
    NO
    
    Note

    In the first sample there are 3 lucky digits (first one and last two), so the answer is "NO".

    In the second sample there are 7 lucky digits, 7 is lucky number, so the answer is "YES".

    In the third sample there are no lucky digits, so the answer is "NO".


    关于幸运数,输入一行数,若他的各位数含4,7的数为4和7则为几乎幸运的数,判断是否为几乎幸运的数,是的话输出YES,否的话输出NO,下面是代码:

    #include<bits/stdc++.h>
    using namespace std;
    typedef long long ll;
    int main()
    {
        int l,b=0;
        char a[19999];
        gets(a);
        l=strlen(a);
        for (int i=0;i<l;i++)
            if(a[i]=='4'||a[i]=='7')
                b++;   // 计数
        printf((b==4||b==7)?"YES":"NO");
    
    }
    这两道题都比较简单,多练A题也能学到c++语言的一些语法。希望自己能越学越好 奋斗


















    展开全文
  • 关于一些初级ACM竞赛题目的分析和题解(一)  故事发生在在2017年年底,受我的室友cy1999巨巨的影响下,第一次接触到ACM竞赛,也是作为一名编程小白,第一次感受到编程语言的魅力。用竞赛这种形式来提高自己的编程...

          关于一些初级ACM竞赛题目的分析和题解(一)

      故事发生在在2017年年底,受我的室友cy1999巨巨的影响下,第一次接触到ACM竞赛,也是作为一名编程小白,第一次感受到编程语言的魅力。用竞赛这种形式来提高自己的编程能力,虽说不上是曲径通幽,但也不失为一种好方法。废话少说,上题。

    A. Football
    time limit per test
    2 seconds
    memory limit per test
    256 megabytes
    input
    standard input
    output
    standard output

    Petya loves football very much. One day, as he was watching a football match, he was writing the players' current positions on a piece of paper. To simplify the situation he depicted it as a string consisting of zeroes and ones. A zero corresponds to players of one team; a one corresponds to players of another team. If there are at least 7 players of some team standing one after another, then the situation is considered dangerous. For example, the situation 00100110111111101 is dangerous and 11110111011101 is not. You are given the current situation. Determine whether it is dangerous or not.

    Input

    The first input line contains a non-empty string consisting of characters "0" and "1", which represents players. The length of the string does not exceed 100 characters. There's at least one player from each team present on the field.

    Output

    Print "YES" if the situation is dangerous. Otherwise, print "NO".

    Examples
    input
    001001
    
    output
    NO
    
    input
    1000000001
    
    output
    YES
    

    题目简单易懂,输入一行n个只包含0,1的数字串(n<100),若其中有连着7个0,或7个1,则输出YES,否则输出NO,

    #include<bits/stdc++.h>
    using namespace std;
    typedef long long ll;     //以上是打竞赛题的套路
    int main()
    {
        char a[101];          //定义字符串
        gets (a);             //数组的输入
        puts(strstr(a,"0000000")||strstr(a,"1111111")?"YES":"NO");  //数组的输出,且strstr(a,b)判断b是否为a的子集
    }
    A. Next Round
    time limit per test
    3 seconds
    memory limit per test
    256 megabytes
    input
    standard input
    output
    standard output

    "Contestant who earns a score equal to or greater than the k-th place finisher's score will advance to the next round, as long as the contestant earns a positive score..." — an excerpt from contest rules.

    A total of n participants took part in the contest (n ≥ k), and you already know their scores. Calculate how many participants will advance to the next round.

    Input

    The first line of the input contains two integers n and k (1 ≤ k ≤ n ≤ 50) separated by a single space.

    The second line contains n space-separated integers a1, a2, ..., an (0 ≤ ai ≤ 100), where ai is the score earned by the participant who got the i-th place. The given sequence is non-increasing (that is, for all i from 1 to n - 1 the following condition is fulfilled: ai ≥ ai + 1).

    Output

    Output the number of participants who advance to the next round.

    Examples
    input
    8 5
    10 9 8 7 7 7 5 5
    
    output
    6
    
    input
    4 2
    0 0 0 0
    
    output
    0
    
    Note

    In the first example the participant on the 5th place earned 7 points. As the participant on the 6th place also earned 7 points, there are 6 advancers.

    In the second example nobody got a positive score.


    这个题目是输入n,k,(1 ≤ k ≤ n ≤ 50第二行输入n个数字(0 ≤ ai ≤ 100),且递减 输出有多少个数 大于等于第k个数,以下是代码

    #include<bits/stdc++.h>
    using namespace std;
    int n,k,c,b,a[57];
    int main()
    {
        cin>>n>>k;
        while (n>b)
    
        cin>>a[b++];    //  输入数组
        while (a[c]&&a[c]>=a[k-1]) // a[c]不等于0且a[c]大于等于a[k-1]
            c++;
        cout<<c;  //输出c
    }







    展开全文
  • 关于一些初级ACM竞赛题目的分析和题解(十)   西面的题目是关于一些字母变换的,上题: A. Word time limit per test 2 seconds memory limit per test 256 megabytes input standard ...

    关于一些初级ACM竞赛题目的分析和题解(十) 

       西面的题目是关于一些字母变换的,上题:

    A. Word
    time limit per test
    2 seconds
    memory limit per test
    256 megabytes
    input
    standard input
    output
    standard output

    Vasya is very upset that many people on the Net mix uppercase and lowercase letters in one word. That's why he decided to invent an extension for his favorite browser that would change the letters' register in every word so that it either only consisted of lowercase letters or, vice versa, only of uppercase ones. At that as little as possible letters should be changed in the word. For example, the word HoUse must be replaced with house, and the word ViP — with VIP. If a word contains an equal number of uppercase and lowercase letters, you should replace all the letters with lowercase ones. For example, maTRIx should be replaced by matrix. Your task is to use the given method on one given word.

    Input

    The first line contains a word s — it consists of uppercase and lowercase Latin letters and possesses the length from 1 to 100.

    Output

    Print the corrected word s. If the given word s has strictly more uppercase letters, make the word written in the uppercase register, otherwise - in the lowercase one.

    Examples
    input
    HoUse
    
    output
    house
    
    input
    ViP
    
    output
    VIP
    
    input
    maTRIx
    
    output
    matrix
    

    输入
    第一行包含一个单词s - 由大写和小写拉丁字母组成,长度从1到100。
    输出
    打印纠正的单词s。 如果给定的单词s具有更多的大写字母,则将该单词写入大写寄存器中,否则  以小写字母写入。

    题意即一行字符串若是大写字母数大于小写字母数则把这一行字符变为大写,反之,变为小写,下面是代码:

    #include<bits/stdc++.h>
    using namespace std;
    typedef long long ll;
    int l,c,b;
    int main()
    {
        char a[300];
    
        scanf("%s",a);
        l=strlen(a);
        for (int i=0;i<l;i++)
            {
            if(a[i]>=97)c++;  //不同类型计数
            else b++;
            }
        if (c>=b)  // 比较大小写的字符数目
        {
            for (int j=0;j<l;j++)
                if(a[j]<97)a[j]+=32;  //执行
            return 0*printf("%s",a);
        }
            if (c<b)
        {
            for (int j=0;j<l;j++)
                if(a[j]>=97)a[j]-=32;
            return 0*printf("%s",a);  //  输出结果
        }
    
    
    }
    








    展开全文
  • 关于一些初级ACM竞赛题目的分析和题解(七)  昨晚和cy1999相约一起打cf,结果晚了一个小时进的时候菜都快凉了,幸亏都skip了不然就掉分到newbie了,下面上题: A. Supermarket time limit ...
  • 关于一些初级ACM竞赛题目的分析和题解(五)。 拓展了一些字母变换的题目,看题:  131A. cAPS lOCK time limit per test 0.5 second memory limit per test 256 megabytes input...
  • 关于一些初级ACM竞赛题目的分析和题解(六)。 下面是关于一些关于数字判断的题,比较简单,先来看第一题: A. Lucky Division time limit per test 2 seconds memory limit per test 256 ...
  • 关于一些初级ACM竞赛题目的分析和题解(四) 今天做的题略有难度,以前的题目简单,只是对一行字符串,对一组数字,进行操作或判断,下面是一些复杂性的,具有图像性的问题的分析。 A. Tram ...
  • 黄淮学院ACM竞赛试题

    2010-11-17 13:28:23
    黄淮学院第六届计算机程序设计竞赛 预赛试题 试题一 跳水问题 5位跳水高手将参加10m高台跳水决赛,有好事者让5人根据实力预测比赛结果。 A选手说:B第二,我第三; B选手说:我第二,E第四; C选手说:我第一,D第二...
  • acm竞赛题目迭代蜜蜂

    2017-10-29 17:05:16
    Bee Time Limit: 3000ms, Memory Limit: 10000KB , Accepted: 2967, Total Submissions: 3722 Description In Africa there is a very special species of bee. Every year, the female bees of such species gi
  • ACM竞赛试题(word)

    2009-03-02 14:10:32
    ACM/ICPC(ACM International Collegiate Programming Contest, 国际大学生程序设计竞赛)是由国际计算机界历史悠久、颇具权威性的组织ACM(Association for Computing Machinery,国际计算机协会)主办的,世界上公认...
  • 关于一些初级ACM竞赛题目的分析和题解(三)。 今天,辣鸡monster_ayb终于自己做出一道A题算是一点点小进步吧,今天的两道题算是很好理解的,主要是辣鸡ayb以前吧,是知道题目的思路,却不会写,现在练的多了有一...
  • 关于一些初级ACM竞赛题目的分析和题解(二)。 今天写了关于排序的题 中间有加号的复杂的一行字符 其次还有关于tolower函数的应用, 上题
  • 学校某班级有N位学生,每位同学有一身高(假设身高都不相同),根据身高数据数据分析,输出每位同学身高在班级的排名。 输入 第一行 1个整数N(1<=N<=200) 第二行 输入N个数,每个数用空格隔开 ...
  • Sum of Consecutive Time Limit: 3000ms, Memory Limit: 10000KB , Accepted: 2088, Total Submissions: 7896 Description Some positive integers can be represented by a sum of one or more consecutive pri
  • 很好 很全 的发挥地方和反对和法规规范和规范及法国警方根据交易分可以
  • //约瑟夫问题,最典型的是应用于猴子选大王,递推公式的思路是拿掉一只猴子之后相当于把(n-1)只猴子按一定规律重排编号之后再开始选大王 #include <stdio.h> int f(int n, int m) { if (n == 1) ...
  • 【问题描述】求m/n小数点后100位的精确值,其中m,n的取值在integer范围。 【输入格式】整数m, n 【输出格式】m/n=…. 【输入样例】 11 13 【输出样例】0....

空空如也

空空如也

1 2 3 4 5 ... 20
收藏数 15,578
精华内容 6,231
关键字:

acm竞赛题目