0 like 0 dislike
5.5k views
時鐘上有時針有分針,分針每一分鐘跳一次,分針每跳一次時針也會前進相對應的角度。請設計一程式,由使用者輸入一個時間,程式會計算出時針與分針間的夾角後輸出。

輸入說明:輸入包含兩個正整數,兩個數之間由一個空白隔開,第一個數字代表時,第二個數字代表分。

輸出說明:請輸出時針與分針間較小的那個夾角。

輸入範例:

12 31

輸出範例

170.5
[Exercise] Coding (C) - asked in 2016-1 程式設計(一)AC by (18k points)
ID: 18067 - Available when: 2016-12-01 18:30:00 - Due to: 2016-12-01 21:00:00

reshown by | 5.5k views

62 Answers

0 like 0 dislike
Hidden content!
#include ******* ** **

#include *

#include **** * ***

#include ** ** * * *

int main1()

{
****** **** ***** * * i,j,h,m,r,a;
* *** * * ****** *** * * * * ,&i);
** * *** * **** * ** ** ** ** ,&j);
* ** *** * * * * ** **** **


** * *** * * ****
********** ** ** * ** *****
******

{
* * * ** * *** ** *** * ***

}


* ** ** * * ** * *** **
** * * *** ** *** ** *** * ***** * *** ** *

return 0;

}
answered by (-248 points)
0 like 0 dislike
Hidden content!
#include ** * *****

#include **** ** ** *

#include * ** ** *

#include * * *** *

int main1()

{
* * * ** *** * * i,j,h,m,r,a;
* *** * ** * * **** * * ** * ** ,&i);
* * * * * *** * ** ** ,&j);
***** * *** * * *


** * * * ** * * ** ***
* * * ****** * * ** ** *
* * ** * ***

{
***** *** * * *** ** ** *

}


*** * * *** ** *
*** ** ** * ** * * **** ***

return 0;

}
answered by (-248 points)
0 like 0 dislike
Hidden content!
* ** ** * ** **


***** ** ** * **


* * ** ** * *


*** * ** * *




* * * ( * )

{


* ***


* **** **** * * * * *
* * * * ** * * * *
(a = {a =
= *
= * ***
* = d - **
** *** * * * = * - *
* * * * *******










* * * *

}
answered by (-276 points)
0 like 0 dislike
Hidden content!
*** * ** ** ** ** *



int main()

{
**** ** **** *** **** ** h, m, * * * degree_m, ans;
* ** * * ** * * * ** ** *** * * *** * * * * **
** ** * ** ** ** * **** * = 30.0 * (h + m / 60.0);
* * * ***** ** * ** * ** = 6.0 * m;


*** * ****** *** * ** = degree_m - ** *
* ********* **** * ** * * * < 0)
* * ***** ** * *** ** ** * * **** ** = - ans;
** **** * * ** ** * ** < 180)
** ** ****** * * * *** ** * * ** * ** ** * * * = 360 - ans;
* * ** ** **** * * * ** ** ** ans);



}
answered by (-90 points)
0 like 0 dislike
Hidden content!
#include<stdio.h>

#include<stdlib.h>

#include<ctype.h>

#include<math.h>



int main()

{

    int a,b;
* * * ** * **** ** angel;
*** **** * * * *** * * ** ** ** **** *
* ** * ** * * ** * * * ** ** * * *
** ** *** * * * * * * *** * * ***
* *** ***** * *** ** ** * ** ** * * * ******* * *
** ** ** ** ******* ** * **** * ** * * **** *
* ** ** ******** ** * *** ** ** * ** **** ** ** **** *** * **** * ** *** *
** * * *** * ** * * *
** ** * *** *** ** **** *** * **** *** **** ** **** ****** ** *** **
*** ** ** * ** * * *** ** * **** ** * *
*** ** ** * * ** * ** * * * * ** * * * * * *** * ***** * ** ** * **

 return 0;

}
answered by (-102 points)
0 like 0 dislike
Hidden content!
* ** *** **** * ***



int main(){
*** * **** * ***** *** h, s;
* ** * ** ** ** * **** i = 0, j = 0, k = 0, t1 = 0;
* * **** ** *** *** ** **** * *** * ** %d", &h, &s);


* ** * *** >= 12)
* * * * * ** * * ** ** * * * * ** = h - 12;
* ** ***** *** * * ** * * * %d ", h, s);
**** * ** * * * * ** = h * 30 + s * 0.5;
** * ****** * * * = s * 6;
* * * *** ********* * * ** * ** %.1f ", i, j);


* * * * ** * ** * * * * * **** < j){
* * * *********** * * ***** *** * * * ** * * * ** = i;
*** * * * * ****** *** ** *** ** * *** * * * = j;
** ******* ** * * ** * ** ** * ** * ** * *** * = t1;
* * * * ****** * ******


*** * ******* ** **** * = i - j;
* ** ** *** ****** * <= 180)
* ** ***** * *** ** **** * ** ** ***** * ****** ** * k);
* * ****** * *** *** * * * **
* ** * ** ** **** ** ** ** * *** ** * * * ******** **** 360 -k);





return 0;

}
answered by (-105 points)
0 like 0 dislike
Hidden content!
#include<stdio.h>

#include<stdlib.h>

#include<ctype.h>

#include<math.h>



int main()

{

    int a,b;
* **** * ** * ** angel;
*** * ** ** * ** ** *** * * ***** * **
* * ** * * * ***** *** ****** **** **
** * *** * * ******* * * ** ** ** * * *****
* * * ****** ** **** * * ** * *** * * * * * *** * * **
* * ** * ** * *** ** * * * * * * * ** * *
* * * * * ***** **** ** * * * ******** * ** * * * * * ** ** * * * * * *** * **
** * **** ***** *** * * * **
* * * ** ** *** * ** *** * * ****** *** * * ** * ****** **
* *** ** * * * ** * ** * * * ** ** * * *
* ** ** ******* * * * ** * * * ** * **** * ** * ** * ***** * * ******* **** *** * **

 return 0;

}
answered by (-102 points)
0 like 0 dislike
Hidden content!
#include <stdio.h>





int main(void)

{
** ** * * * * * m,h;
**** ** ** *** ** *** * ** *** ah,am,a,b;




** * ** *** ** ** * ***** *** ** %d",&h,&m);


* * ** * * * ** ** ** **
** * * * *** * * ** * * ** ** *


** * *** * *** ****** *
***** ** * * *** * **** * **






* **** * ** *** * * * * * *
** * ** * * * *** * * * * * ** * ** *** *


* *** ** ** *** * **** *
*** ** * ***** *** ** *** ** *** ******** * * * *






* *** ** ** **** ** ** * ** * ** * *
*** **** *** **** ** ** 0;











}
answered by (-186 points)
0 like 0 dislike
Hidden content!
* ** * * **
* *** *** * **** ** *
**** * *** ****
* **** * *** ***






* * *****

{
* * *** *

* * *** ** int * * **
** * ** ***

* ** * **
** * ***

* ** * *** *** ag;
* * * *** *

* * ***** * ** * *** * * ** * *** ***** **
* * *

****** * ** if == **
* * *** *

* **** ** * ** ag = min * 6 - min *
** * * **** * * * *

* *** * * * *** * *** * *
**** ** *

}
*** * * ** * ** {
**** * ****

* *** * ** hr = * * * 30 + min * **
*** * ** **

** * ** * *** mi = * * 6;
*** * * *

* * * if (hr ** * * *
* * * ** ****

***** ****** ag = hr - ***
** ** ** *

** * ** * *** *

** * * * **

* ** * *** ag = mi - hr;
**** * *

** * **** * * * ** * * *



}


* ******* *** * 0;

}
answered by (-157 points)
0 like 0 dislike
Hidden content!
* ****** ** *
* ** ** *** * ***



int main()
** * ***** float a, b, c, d, e, f, g;


* * * * ** *** ** ****** * * ** *****


**** * ** *** * *** * *** = 6 * b;
**** * **** **** * * ** **** = 30 * a + 0.5 * b;
* * ** * ** *** * *** = 5.5 * b;
* ***** *** ** * = 5.5 * b - 30 * a;
** * * * * *** ** * **** = 30 * a - 5.5 * b;
*** * *** *** * * * ((a != *** * * * c > d))
*** ** * **** * ** ** ** ** * ** f);}
* ** * *** * *** ** **** if ((a != *** ** * * * c < d))
* * *** * ** * * *** *** **** ** * *** **** * * ** ** ***** * * g);}
** * * * * * * * ** ** if (a = 12)
* * * *** * * ***** ** ** * ** ******* * *** * ** ** e);}
* ***** ****** * if (c = d)
** ** * ** * ** ** *** ** *






** * *** * **** ** * ****** ***



return 0;
* * **
answered by (-98 points)
Welcome to Peer-Interaction Programming Learning System (PIPLS) LTLab, National DongHwa University
English 中文 Tiếng Việt
IP:172.69.58.133
©2016-2025

Related questions

0 like 0 dislike
16 answers
[Exercise] Coding (C) - asked Dec 1, 2016 in 2016-1 程式設計(一)AC by Shun-Po (18k points)
ID: 18075 - Available when: 2016-12-01 18:30:00 - Due to: 2016-12-01 21:00:00
| 2.3k views
0 like 0 dislike
86 answers
[Exercise] Coding (C) - asked Dec 1, 2016 in 2016-1 程式設計(一)AC by Shun-Po (18k points)
ID: 18071 - Available when: 2016-12-01 18:30:00 - Due to: 2016-12-01 21:00:00
| 6.9k views
0 like 0 dislike
49 answers
[Exercise] Coding (C) - asked Dec 1, 2016 in 2016-1 程式設計(一)AC by Shun-Po (18k points)
ID: 18070 - Available when: Unlimited - Due to: Unlimited
| 4k views
0 like 0 dislike
21 answers
[Exercise] Coding (C) - asked Dec 1, 2016 in 2016-1 程式設計(一)AC by Shun-Po (18k points)
ID: 18066 - Available when: 2016-12-01 18:30:00 - Due to: 2016-12-01 21:00:00
| 2.4k views
0 like 0 dislike
0 answers
[Resource] asked Dec 1, 2016 in 2016-1 程式設計(一)AC by Shun-Po (18k points)
ID: 18085 - Available when: Unlimited - Due to: Unlimited
| 10 views
12,783 questions
183,442 answers
172,219 comments
4,824 users