Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- Author: Cao Beijian
- Result: AC Submission_id: 4278576
- Created at: Tue Apr 05 2022 21:37:20 GMT+0800 (China Standard Time)
- Problem_id: 5477 Time: 4 Memory: 1616
- */
- #include <stdio.h>
- int main(){
- int n = 0, a, i, a03, j;
- scanf("%d", &a);
- a03 = a & 7;
- while(a){
- a >>= 3;
- n++;
- }
- for(i = 2; i >= 0; i--){
- if(a03 & (1 << i)){
- for(j = 0; j < 3 * n; j++){
- putchar('-');
- }
- }
- else{
- for(j = 0; j < n; j++){
- putchar('-');
- }
- for(j = 0; j < n; j++){
- putchar(' ');
- }
- for(j = 0; j < n; j++){
- putchar('-');
- }
- }
- putchar('\n');
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment