[백준 24082] 立方体 (Cube) (C#, C++) - soo:bak
작성일 :
문제 링크
설명
한 변의 길이가 주어질 때, 정육면체의 부피를 구하는 문제입니다.
접근법
한 변의 길이를 세 번 곱하면 부피가 됩니다.
Code
C#
1
2
3
4
5
6
7
8
using System;
class Program {
static void Main() {
var x = int.Parse(Console.ReadLine()!);
Console.WriteLine(x * x * x);
}
}
C++
1
2
3
4
5
6
7
8
9
10
11
12
#include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int x; cin >> x;
cout << x * x * x << "\n";
return 0;
}