Codeforces Round #513 A. Phone Numbers(水題)
題意是輸入n個數字,然後問這n個數字最多能組成多少個手機號,手機號是11位的,而且必須要8開頭。
思路很簡單,求出n/11和8的個數的最小值就好了...
AC程式碼:
#include <bits/stdc++.h> using namespace std; int main() { int n; string str; cin>>n; cin>>str; int len = str.length(); int ans = 0; for(int i=0;i<len;i++){ if(str[i] == '8'){ ans++; } } int x = n / 11; cout<<min(x,ans)<<endl; return 0; }
相關推薦
Codeforces Round #513 A. Phone Numbers(水題)
題意是輸入n個數字,然後問這n個數字最多能組成多少個手機號,手機號是11位的,而且必須要8開頭。 思路很簡單,求出n/11和8的個數的最小值就好了... AC程式
Codeforces Round #513 by Barcelona Bootcamp (rated, Div. 1 + Div. 2).A. Phone Numbers
A. Phone Numbers time limit per test 2 seconds memory limit per test 512 megabytes input standard input output standard output Le
Educational Codeforces Round 30 A[水題/數組排序]
sta getch scan line nta blog clu spl ever A. Chores time limit per test 2 seconds memory limit per test 256 megabytes input
Codeforces Round #247(Div. 2) A. Black Square 水題
A. Black Square time limit per test 1 second memory limit per test 256 megabytes i
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
Codeforces Round #493 (Div. 2) A. Balloons 貪心水題
由於是輸出任意一組解,可以將價值從小到大進行排序,第一個人只選第一個,第二個人選其餘的。再比較一下第一個人選的元素和第二個人所選元素和是否相等即可。由於已將所有元素價值從小到大排過序,這樣可以保證在有解的情況下一定可以構造出可行解。 Code: #include
【Codeforces Round 332 (Div 2)A】【水題】A. Patrick and Shopping 遍歷三元環的最小成本
Today Patrick waits for a visit from his friend Spongebob. To prepare for the visit, Patrick needs to buy some goodies in two stores located near his hous
Codeforces Round #527 (Div. 3) A. Uniform String(水題)
題目連結:http://codeforces.com/contest/1092/problem/A 題意:給你n輸出長度為n字串,k是迴圈的長度,比如k為3就是abc迴圈,k為4就是abcd迴圈。 #include <bits/stdc++.h> using namespac
Educational Codeforces Round 23 A-F 補題
als nal 枚舉 typedef code col sca 復雜 long long A Treasure Hunt 註意負數和0的特殊處理。。 水題。。 然而又被Hack了 嗎的智障 #include<bits/stdc++.h> using names
Educational Codeforces Round 21 A-E題題解
說了 else round int 排序 總量 允許 main ret A題 ............太水就不說了,貼下代碼 #include<string> #include<iostream> #include<cstring&
Codeforces Round #439 (Div. 2)(補題) A模擬+set B 數學 C dp or 楊輝三角組合數
— This is not playing but duty as allies of justice, Nii-chan! — Not allies but justice itself, Onii-chan! With hands joined, go everywhere at a speed fas
Codeforces Round #420 A
clu set tac 一個 nbsp 思路 turn 不為 stack Okabe and Future Gadget Laboratory 題意:給一個矩陣,如果矩陣中任意一個不為1的數都滿足 存在一對 s t 使得 ais+atj=aij 思路:xjb暴力寫 AC代碼
Educational Codeforces Round 24 A
num them have time take tin return == logs There are n students who have taken part in an olympiad. Now it‘s time to award the students.
Codeforces Round #422 A
main () min force c++ href const col return I‘m bored with life 題意:給一個a,b,求 gcd(a!,b!),輸出min(a,b)! 就可以了 AC代碼: #include<bits/stdc++.h&
Codeforces Round #395 A
ret pre 代碼 queue you mem 奧數 href sync Taymyr is calling you 題意:給你n,m求不超過z的即是n的倍數又是m的倍數的樹有多少個 思路:z/(n*m) *gcd(n,m)小學奧數題,或者直接暴力也可以 AC代碼:
Codeforces Round #360 A
char for test 個人 long math.h mem eof spa Opponents 題意:一共有d天,每天和n個人打架,如果某天n個人有人沒有出現,那麽可以打贏,問最多連續打贏幾天,輸入d個字符串,第i位為0表示第i個人沒有出現,為1表示出現了 思路:xj
Codeforces Round #427 A
test second http esp main size return rst ac代碼 Key races 題意: 思路:xjb寫 AC代碼: #include "iostream" #include "string.h" #include "stack" #inc
HDU 6182 A Math Problem 水題
std 水題 div 輸出 iterator code php else fin 題目鏈接: http://acm.hdu.edu.cn/showproblem.php?pid=6182 題目描述: 輸入N, 輸出滿足k^k <= N 的 k的個數 解題思
Codeforces Round #418 A--An abandoned sentiment from past
input force play bsp tchar sequence secret contains ash A few years ago, Hitagi encountered a giant crab, who stole the whole of her body
Codeforces Round #436 A. Fair Game
set string ems 題意 include 代碼 example return round 題意:給你n張卡片,上面寫有數字,兩個人選擇兩個數字,把相同數字的卡片都拿走,問能不能拿走所有的卡片並且兩個人拿的卡片書相同。 Examples Input 4112727