公式

A - Dice 解説 by en_translator


For beginners

The answer is Yes if \(X\) is between \(3\) and \(18\) (inclusive), and No otherwise. Use an if statement to implement a conditional branch, and print the result.

Sample code (C++)

#include<bits/stdc++.h>
using namespace std;

int main(){
  int x;
  cin >> x;
  if(3 <= x && x <= 18){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
}

Sample code (Python)

X = int(input())
if 3 <= X <= 18:
  print("Yes")
else:
  print("No")

投稿日時:
最終更新: