728x90
10699๋ฒ: ์ค๋ ๋ ์ง
์์ธ์ ์ค๋ ๋ ์ง๋ฅผ ์ถ๋ ฅํ๋ ํ๋ก๊ทธ๋จ์ ์์ฑํ์์ค.
www.acmicpc.net
๋ฌธ์
์์ธ์ ์ค๋ ๋ ์ง๋ฅผ ์ถ๋ ฅํ๋ ํ๋ก๊ทธ๋จ์ ์์ฑํ์์ค.
์ถ๋ ฅ
์์ธ์ ์ค๋ ๋ ์ง๋ฅผ "YYYY-MM-DD" ํ์์ผ๋ก ์ถ๋ ฅํ๋ค.
์์ ์ถ๋ ฅ
2015-01-24
Solution
#include <iostream>
int main(){
std::cout << "2022-08-04";
return 0;
}
์ถ๊ฐ๋ก, ๋ฌธ์์ด๋ง ์ ๋ ฅํ๋ ๊ฒ์ด ํ์ฌ ๋ ์ง์ ํ์ฌ ์๊ฐ์ ์ถ๋ ฅํ ์ ์๋๋ก ํ๋ ์ฝ๋๋ค.
#include <iostream>
#include <ctime>
#include <string>
#include <stdio.h>
const std::string currentDateTime() {
time_t now = time(0);
struct tm tstruct;
char buf[80];
tstruct = *localtime(&now);
strftime(buf, sizeof(buf), "%Y-%m-%d",&tstruct);
return buf;
}
int main() {
std::cout << currentDateTime();
}728x90
'๐งฉ Algorithm > [BOJ] Bronze' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
| BOJ 10998๋ฒ : AรB (C++/Python/Bronze 5) (0) | 2022.08.04 |
|---|---|
| BOJ 25083๋ฒ : ์์น (C++/Bronze 5) (0) | 2022.08.04 |
| BOJ 7287๋ฒ : ๋ฑ๋ก (C++/Bronze 5) (0) | 2022.08.04 |
| BOJ 2577๋ฒ : ์ซ์์ ๊ฐ์ (C++/Bronze 2) (0) | 2022.08.03 |
| BOJ 2231๋ฒ : ๋ถํดํฉ (C++/Bronze 2) (0) | 2022.08.02 |