摘要: ''' RGB To Hex Conversion https://www.codewars.com/kata/513e08acc600c94f01000001/train/python 255, 255, 255 --> "FFFFFF" 255, 255, 300 --> "FFFFFF" 0, 阅读全文
posted @ 2025-03-07 20:36 Kazuma_124 阅读(11) 评论(0) 推荐(0)
摘要: # codewars,Calculating with Functions ''' seven(times(five())) # must return 35 four(plus(nine())) # must return 13 eight(minus(three())) # must retur 阅读全文
posted @ 2025-03-07 20:35 Kazuma_124 阅读(10) 评论(0) 推荐(0)
摘要: # https://www.codewars.com/kata/51ba717bb08c1cd60f00002f/solutions/python?filter=all&sort=best_practice&invalids=false # Range Extraction def solution 阅读全文
posted @ 2025-03-07 20:34 Kazuma_124 阅读(8) 评论(0) 推荐(0)
摘要: ''' codewars,Tic-Tac-Toe Checker,525caa5c1bf619d28c000335 ''' def is_solved(board): isFull = True for i in range(3): if board[i][0]==0 or board[i][1]= 阅读全文
posted @ 2025-03-07 20:34 Kazuma_124 阅读(19) 评论(0) 推荐(0)
摘要: ''' The observed PIN,https://www.codewars.com/kata/5263c6999e0f40dee200059d/train/python ''' def get_pins(observed): adjacent = { '0' : '08', # 0 '1' 阅读全文
posted @ 2025-03-07 20:33 Kazuma_124 阅读(31) 评论(0) 推荐(0)
摘要: # Sum of Intervals # https://www.codewars.com/kata/52b7ed099cdc285c300001cd/train/python def sum_of_intervals(intervals): intervals.sort(key = lambda 阅读全文
posted @ 2025-03-07 20:33 Kazuma_124 阅读(13) 评论(0) 推荐(0)
摘要: # Strings Mix # https://www.codewars.com/kata/5629db57620258aa9d000014 def mix(s1, s2): s1 = ''.join([c for c in s1 if c.islower()]) # [c for c in s1 阅读全文
posted @ 2025-03-07 20:32 Kazuma_124 阅读(11) 评论(0) 推荐(0)
摘要: # Roman Numerals Helper # https://www.codewars.com/kata/51b66044bce5799a7f000003/train/python class RomanNumerals: # @staticmethod 是一个装饰器, 用来标识一个方法为静态 阅读全文
posted @ 2025-03-07 20:32 Kazuma_124 阅读(9) 评论(0) 推荐(0)
摘要: # Twice linear # https://www.codewars.com/kata/5672682212c8ecf83e000050/train/python def dbl_linear(n): # i=0 # j=0 i,j = 0,0 #同时定义多个变量的方式 sequence = 阅读全文
posted @ 2025-03-07 20:31 Kazuma_124 阅读(9) 评论(0) 推荐(0)
摘要: //B. Transfusion #include <iostream> #include <vector> void solve(){ int n; std::cin>>n; int countOfOdd = (n+1)/2; int countOfEven = n/2; long long su 阅读全文
posted @ 2025-03-07 20:29 Kazuma_124 阅读(14) 评论(0) 推荐(0)
摘要: //A. Line Breaks #include <string> #include <iostream> void solve(){ int n,left; std::cin>>n>>left; int count = 0; while(n--){ std::string temp; std:: 阅读全文
posted @ 2025-03-07 20:29 Kazuma_124 阅读(24) 评论(0) 推荐(0)
摘要: #include <iostream> void solve(){ int n,a,b,c; std::cin>>n>>a>>b>>c; int ans = n/(a+b+c) * 3; n = n%(a+b+c); if(n==0){ std::cout<<ans<<std::endl; retu 阅读全文
posted @ 2025-03-07 20:28 Kazuma_124 阅读(7) 评论(0) 推荐(0)
摘要: //luogu,P11568 「chaynOI R1 T1」一维数组p11568 //洛谷T382521 #include <iostream> int main(){ int n,m; std::cin>>n>>m; for(int i = 0;i<n;++i){ std::cout<<1; } 阅读全文
posted @ 2025-03-07 20:28 Kazuma_124 阅读(16) 评论(0) 推荐(0)
摘要: //codeforces 2057B #include <iostream> #include <utility> #include <set> #include <map> #include <numeric> struct cmp{ bool operator()(const std::pair 阅读全文
posted @ 2025-03-07 20:27 Kazuma_124 阅读(9) 评论(0) 推荐(0)
摘要: #include <iostream> void solve(){ int n,a,b;std::cin>>n>>a>>b; if((a-b)%2==0 || (b-a)%2==0){ std::cout<<"YES"<<std::endl; }else{ std::cout<<"NO"<<std: 阅读全文
posted @ 2025-03-07 20:26 Kazuma_124 阅读(6) 评论(0) 推荐(0)
摘要: #include <iostream> #include <vector> #include <climits> void solve(){ int n;std::cin>>n; std::vector<int> a(n); for(int i = 0;i<n;++i)std::cin>>a[i]; 阅读全文
posted @ 2025-03-07 20:26 Kazuma_124 阅读(18) 评论(0) 推荐(1)
摘要: //codeforce 2053B #include <iostream> #include <vector> #include <unordered_set> #include <map> #include <algorithm> void solve(){ int n;std::cin>>n; 阅读全文
posted @ 2025-03-07 20:25 Kazuma_124 阅读(14) 评论(0) 推荐(0)
摘要: // / Universal Online Judge //#15. 【NOIP2014】生活大爆炸版石头剪刀布 #include <iostream> #include <vector> void once(int& aPoint,int& bPoint,int a,int b){ if(a==b 阅读全文
posted @ 2025-03-07 20:25 Kazuma_124 阅读(34) 评论(0) 推荐(0)
摘要: //codeforces 2057A #include <iostream> void solve(){ int n,m;std::cin>>n>>m; std::cout<< (n>m?n:m)+1<<std::endl; } int main(){ int t;std::cin>>t; whil 阅读全文
posted @ 2025-03-07 20:25 Kazuma_124 阅读(11) 评论(0) 推荐(0)
摘要: // URL: https://codeforces.com/contest/2053/problem/A #include <iostream> void solve(){ int n;std::cin>>n; bool flag = false; int a;std::cin>>a; for(i 阅读全文
posted @ 2025-03-07 20:24 Kazuma_124 阅读(58) 评论(0) 推荐(0)
摘要: // URL: https://codeforces.com/gym/2051/problem/D #include <iostream> #include <vector> #include <algorithm> void solve(){ long long ans = 0; int n;lo 阅读全文
posted @ 2025-03-07 20:24 Kazuma_124 阅读(21) 评论(0) 推荐(0)
摘要: //codeforces 2051C #include <iostream> #include <vector> void solve(){ int n,m,k;std::cin>>n>>m>>k; if(k==n){ for(int i = 0;i<m;++i){ std::cout<<'1'; 阅读全文
posted @ 2025-03-07 20:23 Kazuma_124 阅读(8) 评论(0) 推荐(0)
摘要: //luogu,P11654 「FAOI-R5」becoder #include <iostream> #include <vector> int main(){ int n,L,R;std::cin>>n>>L>>R; --L;--R; std::vector<int> time(n),memor 阅读全文
posted @ 2025-03-07 20:23 Kazuma_124 阅读(79) 评论(0) 推荐(0)
摘要: //luogu,P1603 斯诺登的密码 #include <iostream> #include <set> #include <string> #include <map> /* one two three four five six seven eight nine ten eleven tw 阅读全文
posted @ 2025-03-07 20:22 Kazuma_124 阅读(29) 评论(0) 推荐(0)
摘要: //luogu,P11679 [Algo Beat Contest 001 A] Animal Beheaded #include <string> #include <iostream> int main(){ int a;std::cin>>a; std::string str; std::ci 阅读全文
posted @ 2025-03-07 20:21 Kazuma_124 阅读(8) 评论(0) 推荐(0)
摘要: //luogu,P11681 [Algo Beat Contest 001 C] Creating a Queue #include <iostream> #include <set> int main(){ int N,M;std::cin>>N>>M; int countOfZero = 0; 阅读全文
posted @ 2025-03-07 20:21 Kazuma_124 阅读(8) 评论(0) 推荐(0)
摘要: //luogu,P11680 [Algo Beat Contest 001 B] Between Head and Tail #include <algorithm> #include <iostream> void solve(){ int l,r;std::cin>>l>>r; for(int 阅读全文
posted @ 2025-03-07 20:20 Kazuma_124 阅读(10) 评论(0) 推荐(0)
摘要: /* codeforces,466AA. Cheap Travel 1张票a元, m张票b元, 买n张票, 最少多少钱 哪种方式均价更低就用哪种方式 要注意最终可能有的不足m张票的尾部 要计算哪种方式更划算 是用更高的均价单只买需要的票数 还是用更低的均价却要买满m张票 */ #include <i 阅读全文
posted @ 2025-03-07 20:18 Kazuma_124 阅读(13) 评论(0) 推荐(0)
摘要: /* codewars,Stop gninnipS My sdroW!,5264d2b162488dc400000001 设计一个函数,获取一个字符串, 将该字符串中长度大于等于5的单词反转, 将反转后的内容作为新字符串返回 */ #include <string> #include <iostre 阅读全文
posted @ 2025-03-07 20:14 Kazuma_124 阅读(17) 评论(0) 推荐(0)
摘要: /* codeforces, 1A, Theatre Square 对n*m的方格进行铺砖,每块砖的边长为a,最少需要多少块砖,砖可以裁剪 */ /* n和m除以a向上取整,然后相乘即可 */ #include <iostream> int main(){ int n,m,a; std::cin>> 阅读全文
posted @ 2025-03-07 20:13 Kazuma_124 阅读(6) 评论(0) 推荐(0)
摘要: /* codeforces,43A,Football 两个队伍进行n局比赛,给一个字符串,其中每个字符代表胜利者的队伍,求胜利者 */ /* 用map记录每个队伍的胜利次数,然后遍历map找出胜利次数最多的队伍 */ #include <iostream> #include <string> #in 阅读全文
posted @ 2025-03-07 20:12 Kazuma_124 阅读(10) 评论(0) 推荐(0)
摘要: /* codeforces, 58A, Chat rooms 判断一个字符串是否可以通过移除若干个字符得到 hello 输入一个字符串 输出YES或者NO */ /* 遍历输入字符串看能否按顺序得到h,e,l,l,o这五个字符 */ #include <iostream> #include <str 阅读全文
posted @ 2025-03-07 20:12 Kazuma_124 阅读(13) 评论(0) 推荐(0)
摘要: /* codeforces,69A,Young Physicist n个向量和是否为0,向量为(x,y,z) 第一行输入数字n 之后n行, 每行一个向量, 三个空格隔开的数字 输出YES或NO 和是0输出YES,否则输出NO */ #include <iostream> int main(){ in 阅读全文
posted @ 2025-03-07 20:11 Kazuma_124 阅读(30) 评论(0) 推荐(0)
摘要: /* codeforces,118A,String Task 将一个字符串中的所有元音字母删除,在所有辅音字母前添加一个字符".",并将所有字母转换为小写 输入一个字符串 输出处理后的字符串 */ #include <iostream> #include <string> int main(){ s 阅读全文
posted @ 2025-03-07 20:10 Kazuma_124 阅读(9) 评论(0) 推荐(0)
摘要: /* codeforces,122A,A. Lucky Division 幸运数是仅由4和7组成的数 快要幸运的数是 能被幸运数整除的数 判断一个数是不是快要幸运的数 输入一个数(1<= n <=1000) 如过是快要幸运的数,输出YES否则输出NO */ #include <iostream> # 阅读全文
posted @ 2025-03-07 20:10 Kazuma_124 阅读(13) 评论(0) 推荐(0)
摘要: /* codeforces,131A,A. cAPS lOCK 输入一个字符串,如果这个字符串是全大写或首字母外均大写,则将所有字母大小写反转;否则保持不变 输出处理后的字符串 */ #include <iostream> #include <string> int main(){ std::str 阅读全文
posted @ 2025-03-07 20:10 Kazuma_124 阅读(20) 评论(0) 推荐(0)
摘要: /* codeforces,158B,B. Taxi 将n组学生送到目的地,每组学生包含1~4名学生 每辆车最多载4名学生,每个组的所有学生必须乘坐同一辆车,一辆车可以载多组的学生 最少需要多少辆车 输入 第一行: 一个数字,n 第二行: n个空格隔开的数字,表示第i组学生的人数 */ /* */ 阅读全文
posted @ 2025-03-07 20:09 Kazuma_124 阅读(15) 评论(0) 推荐(0)
摘要: /* codeforces,230A,A. Dragons 桐人需要击败n条龙,若力量大于龙的力量则能击败龙,否则会失败 初始时,桐人的力量为s,击败第i条龙后桐人的力量会增加y_i 第i条龙的力量是x_i 桐人可以按任意顺序与这n条龙对战 输入 s n x_1 y_2 x_1 y_2 ... 输出 阅读全文
posted @ 2025-03-07 20:09 Kazuma_124 阅读(13) 评论(0) 推荐(0)
摘要: /* codeforces, 339B, B. Xenia and Ringroad 问题说明`: 有一个单向环形的道路,长度为n,有m个任务,每个任务都是在道路上的某个位置,按顺序完成这些任务,每次完成一个任务,需要花费这个任务的位置和上一个任务的位置的距离的时间,问完成所有任务需要多少时间。 输 阅读全文
posted @ 2025-03-07 20:07 Kazuma_124 阅读(13) 评论(0) 推荐(0)
摘要: /* codeforces, 479A,A. Expression 问题描述: 给定三个正整数a,b,c,求一个表达式,使得表达式的值最大 使用加法,乘法,括号 输入: 三个正整数a,b,c(1<=a,b,c<=100) 输出: 一个整数,表示表达式的最大值 */ /* 两个正整数数运算,如果有一个 阅读全文
posted @ 2025-03-07 20:07 Kazuma_124 阅读(28) 评论(0) 推荐(0)
摘要: /* codeforces,492B,B. Vanya and Lanternslanterns 问题描述: 有长度为l的街道,n个位置固定的灯笼,每个灯笼可以照亮周围d的范围 照亮整个街道需要的最小的d是多少 输入: 第一行n,l(2<=n<=1000,1<=l<=10^9) 第二行n个数,表示灯 阅读全文
posted @ 2025-03-07 20:06 Kazuma_124 阅读(1) 评论(0) 推荐(0)
摘要: /* codeforces,1873A, A. Short Sort 判断一个由a,b,c组成的字符串是否是可以通过对字符串"abc"进行1次或0次交换字符操作得到 交换字符操作是指,将字符串中的两个字符交换位置 */ /* 符号条件的字符串一定有一个位置的字符与"abc"相同,即 abc,acb 阅读全文
posted @ 2025-03-07 20:02 Kazuma_124 阅读(15) 评论(0) 推荐(0)
摘要: /* codeforces,1956A,A. Nene's Game 题目描述: https://codeforces.com/problemset/problem/1956/A */ #include <iostream> void solve(){ int k,q;std::cin>>k>>q; 阅读全文
posted @ 2025-03-07 20:02 Kazuma_124 阅读(12) 评论(0) 推荐(0)
摘要: /* codeforces,1956B,B. Nene and the Card Game 问题描述: https://codeforces.com/problemset/problem/1956/A */ #include <iostream> #include <vector> void sol 阅读全文
posted @ 2025-03-07 20:02 Kazuma_124 阅读(13) 评论(0) 推荐(0)
摘要: //2048C /* codeforces,2048C,C. Kevin and Binary Strings https://codeforces.com/problemset/problem/2048/C */ #include <iostream> #include <algorithm> v 阅读全文
posted @ 2025-03-07 19:59 Kazuma_124 阅读(27) 评论(0) 推荐(0)
摘要: /* codeforces,2049A,A. MEX Destruction */ #include <iostream> void solve(){ int n; std::cin>>n; bool a=true,b=true; int ans = 0; while(n--){ int temp; 阅读全文
posted @ 2025-03-07 19:58 Kazuma_124 阅读(15) 评论(0) 推荐(0)
摘要: /* codewars,Hamming Numbers,525d84b98f428f14a60008da Hamming数是指其质因子只包含1,3,5的正整数。 即2^i * 3^j * 5^k,其中i,j,k>=0。 要求编写一个函数hamming(n)返回从小到大的第n个Hamming数。 */ 阅读全文
posted @ 2025-03-07 19:51 Kazuma_124 阅读(14) 评论(0) 推荐(0)
摘要: /* codewars,RGB To Hex Conversion,513e08acc600c94f01000001 */ #include <string> std::string rgb_to_hex(int r, int g, int b) { char hexChars[] = "01234 阅读全文
posted @ 2025-03-07 19:51 Kazuma_124 阅读(12) 评论(0) 推荐(0)
摘要: int main(){ int num = 52; const int constNum = 52; //指向常量的指针 const int *ptrToConst = &num; //从右向左, 标识符是ptrToConst,*说明是指针,int说明指针指向的是int,const说明指向的int是 阅读全文
posted @ 2025-03-07 19:47 Kazuma_124 阅读(9) 评论(0) 推荐(0)