Git Product home page Git Product logo

ptaproblems's Introduction

PTA Basic/Advanced/Top Level Problems

The solutions of PTA basic/advanced/top level problems.

PTA, which is also called PAT(Programming Ability Test), has 3 levels and this rep meanly concentrates on the vary solutions of all 3 level problems.

Language

PTA supports about 15 types of programing languages include JavaScript. But this rep only uses these three kinds of widly used languages and it may add others later.

  • C++
  • Java
  • Python3

Now the rep only has C++ solutions so Welcome to pull new files to old/new problems of any level with other languages.

Problems

Now the rep has build some of the basic/advanced level questions. The CREATED.md records these.

Principles of solutions

  • PTA OJ PASSED
  • Correct Answers
  • Correct Answers with Time out
  • Correct Answers with Segmentation fault(illegal input)
  • Correct Answers with Out of Memoey

Attention

All solutions are correct, which means the solution can figure out correct answers without limits of memory and time. So the files with "TIME OUT" or "Segmentation fault"(because of illegal input) are ACCEPTABLE if and only if you note that at the beginning of files.

ptaproblems's People

Contributors

vccddd avatar

Watchers

 avatar  avatar

ptaproblems's Issues

A1042

看暴力解法

#include <cstdio>
#include <iostream>
#include <string>

using namespace std;

int main(int argc, char const *argv[])
{
    string strings[54] = {"S1", "S2", "S3", "S4", "S5", "S6", "S7", "S8", "S9", "S10", "S11", "S12", "S13",
                          "H1", "H2", "H3", "H4", "H5", "H6", "H7", "H8", "H9", "H10", "H11", "H12", "H13",
                          "C1", "C2", "C3", "C4", "C5", "C6", "C7", "C8", "C9", "C10", "C11", "C12", "C13",
                          "D1", "D2", "D3", "D4", "D5", "D6", "D7", "D8", "D9", "D10", "D11", "D12", "D13",
                          "J1", "J2"};
    int k;
    scanf("%d", &k);
    int shuffle[54];
    for (int i = 0; i < 54; i++)
    {
        scanf("%d", &shuffle[i]);
        shuffle[i]--;
    }
    string ans[54];
    for (int i = 0; i < 54; i++)
    {
        ans[i] = strings[i];
    }
    for (int j = 0; j < k; j++)
    {
        string temp[54];
        for (int i = 0; i < 54; i++)
        {
            temp[shuffle[i]] = ans[i];
        }
        for (int i = 0; i < 54; i++)
        {
            ans[i] = temp[i];
        }
    }
    for (int i = 0; i < 54; i++)
    {
        if (i != 0)
            printf(" ");
        cout << ans[i];
    }
    return 0;
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.