標籤:esc ext 網路 模式 style height contest test code
微軟手機的訊號顯示
微軟近日推出了一款功能極簡的手機,在手機上用一個包含了 7×77 \times 77×7 個像素的地區來顯示手機訊號。滿訊號的時候顯示如下:
每一格訊號(第 i(1≤i≤5)i(1 \le i \le 5)i(1≤i≤5) 格訊號有 iii 個-)代表 20%20\%20% 的訊號強度,不足一格訊號的部分不顯示。同時會在右上方顯示當前的網路傳輸模式。在訊號強度不低於 90%90\%90% 的時候顯示4G;當訊號低於 90%90\%90%、不低於 60%60\%60% 的時候顯示3G;否則顯示E。
對於給定的當前訊號強度 d%d\%d%,輸出訊號的 7×77 \times 77×7 像素的圖案。
輸入格式
輸入一個整數 d(0≤d≤100)d(0 \le d \le 100)d(0≤d≤100),表示訊號強度。
輸出格式
按照題目要求輸出,每行末尾不要輸出多餘的空白字元。
範例輸入1
0
範例輸出1
+-----+| E|| || || || |+-----+
範例輸入2
65
範例輸出2
+-----+|- 3G||-- ||--- || || |+-----+
直接6個if就可以了。
1 #include <bits/stdc++.h> 2 using namespace std; 3 int main(){ 4 int d; 5 cin>>d; 6 if(d < 20){ 7 cout << "+-----+\n| E|\n| |\n| |\n| |\n| |\n+-----+\n" << endl; 8 }else if(d < 40){ 9 cout << "+-----+\n|- E|\n| |\n| |\n| |\n| |\n+-----+\n"<< endl;10 }else if(d < 60){11 cout << "+-----+\n|- E|\n|-- |\n| |\n| |\n| |\n+-----+\n"<< endl;12 }else if(d < 80){13 cout << "+-----+\n|- 3G|\n|-- |\n|--- |\n| |\n| |\n+-----+\n"<< endl;14 }else if(d < 90){15 cout << "+-----+\n|- 3G|\n|-- |\n|--- |\n|---- |\n| |\n+-----+\n"<< endl;16 }else if(d < 100){17 cout << "+-----+\n|- 4G|\n|-- |\n|--- |\n|---- |\n| |\n+-----+\n"<< endl;18 }else if(d == 100){19 cout << "+-----+\n|- 4G|\n|-- |\n|--- |\n|---- |\n|-----|\n+-----+\n"<< endl;20 }21 return 0;22 }
微軟手機的訊號顯示