حالت آفلاین — محتوا از حافظهٔ کش نمایش داده می‌شود
همهٔ تمرین‌ها

محاسبه امتیاز تیم فوتبال

تمرین آسان 3309 visibility link download flag

جمع امتیازات یک تیم که در مسابقات لیگ برتر فوتبال کسب کرده در ورودی به شما داده می شود و شما جمع امتیازات تیم به همراه تعداد بردهای این تیم در این فصل را در خروجی چاپ می کنید.

این تیم، ۱۵ بازی انجام میدهد پس در ۱۵ خط امتیازات این تیم به شما داده می شود. به ازای هر بازی تیم یا صفر امتیاز کسب کرده یا یک و یا سه امتیاز. این تیم در صورت باخت صفر امتیاز، در صورت تساوی یک امتیاز و در صورت برد سه امتیاز کسب می کند.

ورودی نمونه:

3 3
3 3
3 0
0 0
0 0
1 1
1 1
1 3
3 3
3 3
0 0
0 0
0 1
1 1
1 1
👨‍💻 4 ساعت قبل کاربر ناشناس این تمرین رو مشاهده کرد

پاسخ‌ها 16

games= int(input("games:"))
wins= int(input("wins:"))
draws= int(input("draw:"))
loses= int(input("lose:"))
win=3
lose=0
draw=1
win_point= wins*win
draw_point= draws*draw
lose_point= loses*lose
all_points= win_point+draw_point+lose_point
print (f"all wins:{wins}")
print (f"all points:{all_points}")
#include<iostream>
    using namespace std;
    int main() {
int x;
    int sum=0 , total=0;
    for (int i=0; i<15 ;i++) {
                    cin>>x;
sum+=x;
    if(x==3) {++total;} }
cout<< sum <<"  "<<total;   

    return 0;}
input_choice = ["0","1","3"]
score_input = "1,1,1,3,3,3,3"
scores_list = score_input.split(",")
scores = []
win = 0

for score in scores_list:
    if score in input_choice:
        score = int(score)
        scores.append(score)
        if score == 3:
            win += 1
    else:
        print("Value is Not Valide")

print(f"Your Scores is : {sum(scores)}")
print(f"The Number Of Win is : {win}")

#include<iostream>
int main(){
    int sum=0;
    int won=0;
    int equal=0;
    int fail=0;
    for (int i=1;i<=15;i++){
    std::cout<<"Enter scors:";
    int score;
    std::cin>> score;
    if(score==0||score==1||score==3){
        sum+=score;
        if (score==3)
            won++;
        if (score==1)
            equal++;
        if (score==0)
            fail++;
    }
    else
       std::cout<< "Enter correct score: ";}
    std::cout<<"this team's score: "<<sum<<" from "<<won<< " victory and "<<equal<< " equality and "<<fail<< " failure ";
    return 0;
equal_scores=0
lose=0
win_scores=0
count=0

for i in range(15):
    scores1, scores2 = map(int, input("Enter the results: ").split())
    if scores1==scores2:
        equal_scores+=1
    elif scores1<scores2:
        lose+=0
    elif scores1>scores2:
        win_scores+=3
        count+=1

all_scores=win_scores+equal_scores
print("kol:",all_scores,"\ntedad_win:",count)

ارسال جواب

جوابت را با Markdown بنویس و ثبت کن

×
بستن