CodeForces 785A Anton and Polyhedrons
簡單判斷。
分別判斷每個單詞是幾面體,加起來就是答案。
#include <cstdio> #include <cmath> #include <cstring> #include <map> #include <algorithm> using namespace std; int n; char s[1000]; int sum; int main() { scanf("%d",&n); for(int i=1;i<=n;i++) { scanf("%s",s); if(s[0]==‘T‘) sum+=4; if(s[0]==‘C‘) sum+=6; if(s[0]==‘O‘) sum+=8; if(s[0]==‘D‘) sum+=12; if(s[0]==‘I‘) sum+=20; } printf("%d\n",sum); return 0; }
CodeForces 785A Anton and Polyhedrons
相關推薦
CodeForces 785A Anton and Polyhedrons
pac cst mat () ant algo ring light str 簡單判斷。 分別判斷每個單詞是幾面體,加起來就是答案。 #include <cstdio> #include <cmath> #include <cstr
CodeForces 785C Anton and Fairy Tale
valueof ava def log compareto urn port () [] 二分。 如果$n≤m$,顯然只能$n$天。 如果$n>m$,至少可以$m$天,剩余還可以支撐多少天,可以二分計算得到,也可以推公式。二分計算的話可能爆$long$ $l
CodeForces 785D Anton and School - 2
tdi continue article map ces java code detail ans 枚舉,容斥原理,範德蒙恒等式。 先預處理每個位置之前有多少個左括號,記為$L[i]$。 每個位置之後有多少個右括號,記為$R[i]$。 然後枚舉子序列中第一個右括號的位
CodeForces 785E Anton and Permutation
中比 交換 %d 暴力 每次 一個 con brush names 分塊,暴力。 將序列分成$sqrt(n)$塊,每塊$sqrt(n)$個元素,每塊內排序。 每次操作要計算這個區間中比$a[p1]$大的有幾個,小的有幾個,比$a[p2]$大的有幾個,小的有幾個,端點的塊
CodeForces 785D Anton and School - 2 組合數學
school log cer sin 位置 mem cin typedef pair 題意: 給你一串括號 問你有多少種匹配的子串 就是前半部分都是‘(‘ 後半部分都是‘)‘的子串 思路: 首先我們預處理 當前位置之前有多少左括號 和 當前位置之後有多少右括
Codeforces 734C Anton and Making Potions(枚舉+二分)
set making AC 制作 找到 start per ans IV 題目鏈接:http://codeforces.com/problemset/problem/734/C 題目大意:要制作n個藥,初始制作一個藥的時間為x,魔力值為s,有兩類咒語,第一類周瑜有m種,每
A. Anton and Polyhedrons
Anton’s favourite geometric figures are regular polyhedrons. Note that there are five kinds of regular polyhedrons: Tetrahedron. Tetrahedron has
CodeForces - 508B-Anton and currency you all know
Berland, 2016. The exchange rate of currency you all know against the burle has increased so much that to simplify the calculations, its fra
codeforces 785D D. Anton and School - 2
style ems its com -1 return 他能 har pow 題目鏈接:http://codeforces.com/problemset/problem/785/D 題意:給你一個只包含‘(‘和‘)‘的字符串,然後問他的子序列中有多少滿足前一半是左括號,後一
Codeforces Round #379 (Div. 2) E. Anton and Tree
vector #define clu cto bits air int 向上 fin 題意:給你一棵樹, 每個點要麽是黑色要麽是白色, 有一種操作是將同一個顏色的連通塊變成相反的顏色,問你最少變換幾次, 整顆樹變成一種顏色。 思路: 縮點, 加求樹的直徑, 答案為樹
codeforces round #324(div2) E題 Anton and lra
這道E題真的毒瘤啊,看完題解後還花了三小時AC。。。 主要是讓這個位置上的數字如果要換到前面,那麼前面至少有一個要到這個位置上,交換就好啦。 交換之後更新位置,直到這個數字被交換到指定位置。 為了 簡化操作,我們可以把所有目標序列(s列)中數字出現的位置替換p序列中的數字,這樣目標序列轉化成一
codeforces 508 B Anton and currency you all know(水)
Berland, 2016. The exchange rate of currency you all know against the burle has increased so much that to simplify the calculations
codeforces 798C Mike and gcd problem
opera can sample pan using str ssl else font C.Mike and gcd problem Mike has a sequence A?=?[a1,?a2,?...,?an] of length n. He cons
CodeForces 321A Ciel and Robot(數學模擬)
ont amp force 等於 return printf print -- 題意 題目鏈接:http://codeforces.com/problemset/problem/321/A 題意:在一個二維平面中,開始時在(0,0)點,目標點是(a。b),問能不能通過反
Codeforces 794F. Leha and security system 線段樹
log pda 小技巧 ext for names 區間和 tac ant F. Leha and security system Bankopolis, the city you already know, finally go
Codeforces 763A. Timofey and a tree
brush ret force oid clas print ext etc ans A. Timofey and a tree 題意:給一棵樹,要求判斷是否存在一個點,刪除這個點後,所有連通塊內顏色一樣。$N,C \le 10^5$ 想法:這個叫換根吧。先求出一個點合
Codeforces 425A Sereja and Swaps(暴力枚舉)
stdio.h acc 題目 operator priority main bool article continue 題目鏈接:A. Sereja and Swaps 題意:給定一個序列,能夠交換k次,問交換完後的子序列最大值的最大值是多少 思路:暴力枚舉每一個區間
Codeforces 558C Amr and Chemistry 全都變相等
== 求一個 時間 asi 次數 定義 space 思想 %d 題意:給定一個數列,每次操作僅僅能將某個數乘以2或者除以2(向下取整)。求最小的操作次數使得全部的數都變為同樣值。
Codeforces 821C Okabe and Boxes
做到 cnblogs 彈出 sta 分享 一次 har mov res 題意: 給定一個n,然後有2n個指令,分別是add x, remove, add x 就是將x加入到棧中, remove 就是從棧頂移除, 然後移除的元素一定要有序, 不然就需要resort(重排)一次
Codeforces 821A Okabe and Future Gadget Laboratory 題解
can printf else std bre 中間 sub 同一行 clu 此文為博主原創題解,轉載時請通知博主,並把原文鏈接放在正文醒目位置。 題目鏈接:http://codeforces.com/problemset/problem/821/A 時間限制:2秒