Git Product home page Git Product logo

Comments (6)

shayan-azizi avatar shayan-azizi commented on July 28, 2024

Hi!
I can't score 100 in this problem too. quera gives me a score of 71 either.
I tried to solve the problem this time with Python:

def is_good_code (unique_chars : list, code : str) -> bool:
    for c in code:
        if c not in unique_chars:
            return False
    return True

def main () -> None:
    n, discount_code = input().split()
    codes = []

    for i in range (int (n)):
        codes.append (input())

    unique_chars = list(set(discount_code))

    for code in codes:
        if is_good_code(unique_chars, code):
            print ("Yes")

        else:
            print ("No")


if __name__ == "__main__":
    main ()

from queraproblems.

shayan-azizi avatar shayan-azizi commented on July 28, 2024

I tried to solve the problem with c++ too. but it keep giving me 71:

#include <iostream>
using namespace std;

int main(){
    int n;
    string t;
    cin >> n >> t;
    string l[n] = {};
    for(int i = 0; i < n; i++){
        string x;
        cin >> x;
        bool f = 1;
        for(int j = 0; j < x.size(); j++){
            bool f2 = 0;
            for(int k = 0; k < t.size(); k++){
                if (x[j] == t[k]){
                    f2 = 1;
                }
            }
            if (!f2){
                f = 0;
            }
        }
        if (f){
            l[i] = "Yes";
        }
        else{
            l[i] = "No";
        }
    }
    for(int i = 0; i < n; i++){
        cout << l[i] << endl;
    }
}

from queraproblems.

shayan-azizi avatar shayan-azizi commented on July 28, 2024

Hi!
I was finally able to solve the question with the help of one of my friends and I realized that we completely misunderstood the question.
We thought that each letter must be in a special set of letters. But each discount code only changes the order of special letters.

from queraproblems.

HamidMolareza avatar HamidMolareza commented on July 28, 2024

thank you. ❤️
I will check soon and add your name to the list of contributors.

from queraproblems.

HamidMolareza avatar HamidMolareza commented on July 28, 2024

from queraproblems.

HamidMolareza avatar HamidMolareza commented on July 28, 2024

I added this part to thank you again.

from queraproblems.

Related Issues (20)

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.