TOJ 98
題目
https://toj.tfcis.org/oj/pro/98/
輸出 光秒, 光分, 光時, 光日, 光週, 光年 在公尺的單位下的數值
Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
| #include<iostream> using namespace std;
int main() { long long LS; long long LM; long long LH; long long LD; long long LW; long long LY; long long L=299792458; LS=L; LM=L*60; LH=L*60*60; LD=L*60*60*24; LW=L*60*60*24*7; LY=L*60*60*24*365; cout<<"1 Light-second(LS) is "<<LS<<" metres."<<endl; cout<<"1 Light-minute(LM) is "<<LM<<" metres."<<endl; cout<<"1 Light-hour(LH) is "<<LH<<" metres."<<endl; cout<<"1 Light-day(LD) is "<<LD<<" metres."<<endl; cout<<"1 Light-week(LW) is "<<LW<<" metres."<<endl; cout<<"1 Light-year(LY) is "<<LY<<" metres."<<endl;
return 0; }
|
複雜度分析
總時間複雜度約為 $O(1)$