UVa 12114 - Bachelor Arithmetic
題目
已知兩個數字 B 和 S ,判斷計算 (S - i) / (B - i)的變化趨勢(i = 1 ~ B),比值的上界為1。
分析
簡單題。比較大小即可,如果B為1則不能判斷,S≥B則一直為1,否則比值變小。
說明
2019年第一題。沒搶到回家的票ε=ε=ε=(#>д<)ノ
#include <stdio.h>
int main() {
int B, S, T;
for (int t = 1; ~scanf("%d%d", &B, &S); ++ t) {
if (!B && !S) {
break;
}
printf("Case %d: ", t);
if (B == 1) {
printf(":-\\\n");
} else if (B <= S) {
printf(":-|\n");
} else {
printf(":-(\n");
}
}
return 0;
}
相關推薦
UVa 12114 - Bachelor Arithmetic
題目 已知兩個數字 B 和 S ,判斷計算 (S - i) / (B - i)的變化趨勢(i = 1 ~ B),比值的上界為1。 分析 簡單題。比較大小即可,如果B為1則不能判斷,S≥B則一直為1,否則比值變小。 說明 2019年第
UVa 11149 矩陣的冪(矩陣倍增法模板題)
ble 化簡 .cn target ans txt put std net https://vjudge.net/problem/UVA-11149 題意: 輸入一個n×n矩陣A,計算A+A^2+A^3+...A^k的值。 思路: 矩陣倍增法。
UVA - 434 Matty's Blocks
mes [0 () block += tty scan 一個 ems 題意:給你正視和側視圖,求最多多少個,最少多少個 思路:貪心的思想。求最少的時候:由於能夠想象著移動,盡量讓兩個視圖的重疊。所以我們統計每一個視圖不同高度的個數。然後計算。至於的話。就是每次拿正視圖的
UVA 11997 K Smallest Sums 優先隊列 多路合並
algorithm span 大白 while logs truct %d 算法 省賽 vjudge 上題目鏈接:UVA 11997 題意很簡單,就是從 k 個數組(每個數組均包含 k 個正整數)中各取出一個整數相加(所以可以得到 kk 個結果),輸出前 k 小的和
UVA 567 Risk【floyd】
art printf ios org std span app process iostream 題目鏈接: option=com_onlinejudge&Itemid=8&page=show_problem&problem=5
uva 1585
cout clu cnblogs push uva i++ namespace cin str #include <bits/stdc++.h> using namespace std; int main() { int k; cin>&
UVA 1584 環狀序列
-- 開頭 給定 字典 字典序 clu cout con sca 題意: 給定一個環狀字符串,輸出字典序最小的線裝字符串。 分析: 我一開始是將原字符串*2去模擬環,然後分別截取以字符串不同字母為首的子串,然後用sort去排序輸出最小的串,復雜度為O(n^2 + nlogn
Marvelous Mazes UVA - 445
累加 == return include printf str string iostream log #include<iostream> #include<stdio.h> #include<string> #include<
紫書第五章訓練 uva 10763 Foreign Exchange by crq
evo pan hang n) 情況 sed 是否 for ear Your non-profit organization (iCORE - international Confederation of Revolver Enthusiasts) coordinates
UVA 10129 Play on Words
bool seq lis rest ble u+ contains con sync Some of the secret doors contain a very interesting word puzzle. The team of archaeologists ha
【組合計數】UVA - 11538 - Chess Queen
bre cpp name using blog ios log return algorithm 考慮把皇後放在同一橫排或者統一縱列,答案為nm(m-1)和nm(n-1),顯然。 考慮同一對角線的情況不妨設,n<=m,對角線從左到右依次為1,2,3,...,n-1,n
UVA 12563(Jin Ge Jin Qu hao)
case class 利用 i++ its 價值 con == 節省空間 開始認真學DP。我對滾動數組的理解是:後一個狀態可以由前一個狀態求得,便可以使用一維數組重復利用節省空間復雜度。 這個題要註意題目要求的前提,求次數可以看作重量為v[i]價值為1放入w-1的背包,歌曲
POJ 3294 UVA 11107 Life Forms 後綴數組
ise -c orm pac str lap sizeof true n-1 相同的題目,輸出格式有區別。 給定n個字符串,求最長的子串,使得它同時出現在一半以上的串中。 不熟悉後綴數組的童鞋建議先去看一看如何用後綴數組計算兩個字符串的最長公共子串 Ural1517 這道題
【Java】【滾動數組】【動態規劃】UVA - 11137 - Ingenuous Cubrency
得到 lose math scanner light clas details 狀態 ann 滾動數組優化自己畫一下就明白了。 http://blog.csdn.net/u014800748/article/details/45849217 解題思路:本題利用遞推關系解決。
UVa 10651 Pebble Solitaire(DP 記憶化搜索)
src output one row max -s turn -- nth Pebble Solitaire Pebble solitaire is an interesting game. This is a game where you are given
uva 10340 all in all
() ring ace while clu return include all urn #include<bits/stdc++.h> using namespace std; bool cmpare(string t,string s) { int
UVa 1592 Database (map)
tid one 做到 bre 復雜度 font 16px tmp put 題意:給出n行m列的數據庫(數據範圍: n 1~10000, m 1~10), 問你能不能找出兩行r1, r2,使得這兩行中的c1, c2列是一樣的, 即(r1,c1)==(r2,c1) &&
UVA - 10622 Perfect P-th Powers
分享 con perfect max 技術 name ext more ace Description Problem E: Perfect Pth Powers We say that x is a perfect square if, for some integ
UVa 1658,Admiral (拆點+限制最小費用流)
{} name 最小 ssi set dex 一個點 cost line 題目鏈接:https://icpcarchive.ecs.baylor.edu/index.php?option=com_onlinejudge&Itemid=8&page=show_
UVA 12100 打印隊列(STL deque)
bsp -1 優先級 break 位置 for mes ifd cond 題意: 給定n個優先級打印隊列,然後從0開始編號到n-1。出隊一個元素,如果他是隊列中優先級最高的,打印(耗時一分鐘),否則放到隊尾(不耗時)。給定一個m,求位置m的文件打印的時間。 分析: 用一個p