ACM_鬧鐘人生(水題)
鬧鐘人生
Time Limit: 2000/1000ms (Java/Others)
Problem Description:
已知一個時鐘一開始指向0點,順時針走了n個小時,求它最終所指向的數字(時間按12進制計算)。
Input:
多組輸入,每組一個n(-10^7<=n<=10^7)
Output:
輸出指針所指數字
Sample Input:
4 12 15
Sample Output:
4 0 3
解題思路:水題!!!取余。但是要註意的一點,負數取余任何一個不為0的數之後都是負數,又要求輸出是12進制的,負數說明逆時針轉,所以要將其調整成正數,再單一出口取余輸出。水過。
1#include<bits/stdc++.h> 2 using namespace std; 3 int main() 4 { 5 int n; 6 while(cin>>n){ 7 while(n<0)n+=12; 8 cout<<(n%12)<<endl; 9 } 10 return 0; 11 }
ACM_鬧鐘人生(水題)
相關推薦
ACM_鬧鐘人生(水題)
class title sample ont TP 一點 出口 計算 進制 鬧鐘人生 Time Limit: 2000/1000ms (Java/Others) Problem Description: 已知一個時鐘一開始指向0點,順時針走了n個小時,求它最終所指
poj1730 - Perfect Pth Powers(完全平方數)(水題)
ostream splay -- size 技術 () isp close for /* 以前做的一道水題,再做精度控制又出了錯///。。。 */ 題目大意: 求最大完全平方數,一個數b(不超過int範圍),n=b^p,使得給定n,p最大; 題目給你一個數n,求p ; 解題
51nod 1283 最小周長(水題)
com cin ide splay include 面積 nod lac eml 1283 最小周長 題目來源: Codility 基準時間限制:1 秒 空間限制:131072 KB 分值: 5 難度:1級算法題 收藏 關註 取消關註 一個矩形的面積為S,
1283 最小周長(水題)
img icon tdi mage div 一道 自己的 highlight 示例 1283 最小周長 題目來源: Codility 一個矩形的面積為S,已知該矩形的邊長都是整數,求所有滿足條件的矩形中,周長的最小值。例如:S = 24,那麽有{1 24} {2
51nod 1717 好數 (水題)
n) 技術分享 iostream image def 復雜 cout std algorithm 題目: 看起來很復雜,其實就是有多少個素因子就翻轉多少次。 然後考慮到只有平方數有奇數個素因子。 一次過,上代碼把: #include <iost
l洛谷 (水題)P4144 大河的序列
col -o tro body ger ont 代碼 .org show 題目戳 Solution: 這題前面都是廢話,關鍵的一句就是本題求的是序列中連續一段的相與值(&)+相或值(|)最大,然後對這個值進行快速冪取模。考慮到兩個數相與最大能得到的就是這兩個
【POJ】Cow Multiplication(水題)
i++ targe tar AS names += include stream org Cow Multiplication http://poj.org/problem?id=3673 題意:輸入兩個數A B,比如123和45 然後算123*45這個運算是指1*4
【藍橋杯】第六屆國賽C語言B組 1.積分之迷(水題)
水題 urn class %d names 風鈴 需要 藍橋 std 小明開了個網上商店,賣風鈴。共有3個品牌:A,B,C。為了促銷,每件商品都會返固定的積分。 小明開業第一天收到了三筆訂單:第一筆:3個A + 7個B + 1個C,共返積分:315第二筆:4個A + 10個
Finding LCM LightOJ - 1215 (水題)
out printf n) tac vector tps cin cnblogs queue 這題和這題一樣。。。。。。只不過多了個數。。。 Finding LCM LightOJ - 1215 https://www.cnblogs.com/WTSRUVF/p/931
A - I Think I Need a Houseboat HDU - 1065(水題)
啊啊啊 scan 水題 put 開始 end code 題意 \n 題意:給你一個半圓,半圓以面積每年增加50平方英裏的速度擴張。問(x, y)在多少年後被覆蓋、 思路:emmm,其實最開始,還是打表的,因為每一年的半圓的半徑可以算出來。啊啊啊啊,其實這個方法是可以的。
【CodeForces - 215A】【Bicycle Chain】(水題)
題目: Vasya's bicycle chain drive consists of two parts: n stars are attached to the pedal axle, m stars are attached to the rea
Savings Account(水題)
Suppose you open a savings account with a certain initial balance. You will not make any withdrawals or further deposits for a number of years. Th
【CodeForces - 215A】Bicycle Chain (水題)
題幹: Vasya's bicycle chain drive consists of two parts: n stars are attached to the pedal axle, m stars are attached to the rea
【CodeForces - 864A】Fair Game(水題)
Petya and Vasya decided to play a game. They have n cards (n is an even number). A single integer is written on each card. Before t
【CodeForces - 255A】Greg's Workout (水題)
題幹: Greg is a beginner bodybuilder. Today the gym coach gave him the training plan. All it had was n integers a1, a2, ..., an. Thes
NOIP2018 DAY1T1 鋪設道路(水題)
洛谷傳送門 【題目分析】 呵呵,NOIP竟然出原題,是不是刷過積木大賽這道題的人都禁賽啊? 結論很明顯,直接找區間最小值減去即可。 不知道nlogn的演算法能不能過,反正O(n)即可。 我選擇先讀完再掃一遍,當然也可以邊讀邊記錄答案。 記dp[i]表示消除1~i需要的最小次數
NOIP模擬 水管(水題)
傳送門 【題目分析】 為什麼打了endl竟然沒T。。。但為什麼交到網站上又T了 氵題嘛,做法有很多種啊。。。。 我選擇加N-1條邊,這樣就保證了聯通,直接dfs一遍記錄兒子,邊權就是兒子的值,注意修改反向邊。 然後一群人拿著我的程式去比誰跑得快 【程式碼~(呵呵呵呵呵)】
【Ciel and Robot 】【CodeForces - 322C】(水題)
題目: Fox Ciel has a robot on a 2D plane. Initially it is located in (0, 0). Fox Ciel code a command to it. The command was represented by string&nb
Ksusha the Squirrel(水題)
Ksusha the Squirrel is standing at the beginning of a straight road, divided into n sectors. The sectors are numbered 1 to n, from left to right.
Codeforces Round#523 (div2)A -Coins (水題)
原題連結: A. Coins time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard output You have unlimited numb