首页 > TAG信息列表 > 1108

1108 String复读机

代码 #include <iostream> #include <cstdio> #include <string> #include <map> using namespace std; int main() { string s; map<char,int> mp; mp['S']=0; mp['t']=0; mp['r']=0; mp['i']=0

力扣今日题1108. IP 地址无效化

1108. IP 地址无效化 难度是简单。不错,又可以增强信心了!

ybt 1108:向量点积计算

1108:向量点积计算   时间限制: 1000 ms 内存限制: 65536 KB 提交数: 31749 通过数: 25128 【题目描述】 在线性代数、计算几何中,向量点积是一种十分重要的运算。给定两个nn维向量a=(a1,a2,...,an)a=(a1,a2,...,an)和b=(b1,b2,...,bn)b=(b1,b2,...,bn),求点积a⋅b=a1b1

1108: 打印数字图形(函数专题)Python

1108: 打印数字图形(函数专题) 时间限制: 1 Sec 内存限制: 128 MB 提交: 11599 解决: 5830 [状态] [讨论版] [提交] [命题人:admin] 题目描述 从键盘输入一个整数n(1≤n≤9),打印出指定的数字图形。要求在程序中定义并调用如下函数:PrintSpace(m)用来输出m个空格;PrintDigit(m)来

(小白看了都会!)zzulioj 1108: 打印数字图形(函数专题)

哥们儿,姐们儿,代买部分可复制粘贴,但是希望你能看看注释理解之后,一定一定一定不看代码自己敲出来,如果能给我一个小小的赞就更好啦~谢谢你~ 代码及注释如下:   #include<stdio.h> #include<math.h> void PrintDigit(int m); void PrintSpace(int m); int main() {     int n,i;

[leetcode]1108

C: 错误代码 #include <stdio.h> #include <stdlib.h> #include <math.h> #include <string.h> char *defangIPaddr(char *address) { int cnt = 0; char tmp[20]; for (int i = 0; i < strlen(address); i++) { if (address

1108 最小公倍数

hdu 1108 最小公倍数 添加链接描述 #include <bits/stdc++.h> using namespace std; int gcd(int x, int y){ return y ? gcd(y, x % y) : x; } int lcm(int x, int y){ return x/gcd(x,y)*y; } int main(){ int x, y; while(scanf("%d %d", &x, &am

zzulioj 1108: 打印数字图形(函数专题)

题目描述 从键盘输入一个整数n(1≤n≤9),打印出指定的数字图形。要求在程序中定义并调用如下函数:PrintSpace(m)用来输出m个空格;PrintDigit(m)来输出一行中的数字串"12…m…21"(该行中的最大数字是m)。函数原型如下: void PrintDigit(int m); void PrintSpace(int m); 对于C/C++

【字符串】1108. IP 地址无效化

题目:     解法: 1 class Solution { 2 public: 3 string defangIPaddr(string address) 4 { 5 string res ; 6 7 for ( char c : address ) 8 { 9 if ( c == '.' ) 10 { 11

1108. IP 地址无效化

给你一个有效的 IPv4 地址 address,返回这个 IP 地址的无效化版本。 所谓无效化 IP 地址,其实就是用 "[.]" 代替了每个 "."。   示例 1: 输入:address = "1.1.1.1" 输出:"1[.]1[.]1[.]1" 示例 2: 输入:address = "255.100.50.0"输出:"255[.]100[.]50[.]0" class So

【洛谷 1108】低价购买

题目描述 “低价购买”这条建议是在奶牛股票市场取得成功的一半规则。要想被认为是伟大的投资者,你必须遵循以下的问题建议:“低价购买;再低价购买”。每次你购买一支股票,你必须用低于你上次购买它的价格购买它。买的次数越多越好!你的目标是在遵循以上建议的前提下,求你最多能购买

[牛客] [#1108 J] [树形结构] 买一送一

2019牛客国庆集训派对day3 链接:https://ac.nowcoder.com/acm/contest/1108/J来源:牛客网 题意 ICPCCamp 有 n 个商店,用 $1,2,...,n$ 编号。对于任意 i > 1,有从商店 $p_i$​ 到 i 的单向道路。 同时,商店 i 出售类型为 $a_i$​ 的商品。 Bobo 从商店 1 出发前往商店 i。他要在两个不

1108. Defanging an IP Address

1108. Defanging an IP Address 题目描述 Example 1: Input: address = "1.1.1.1" Output: "1[.]1[.]1[.]1" Example 2: Input: address = "255.100.50.0" Output: "255[.]100[.]50[.]0" 分析: 题目的目的就是将一个字符串里的字符.替换为[.]。 方法1 创建一个空字符ans作

1108. IP 地址无效化

给你一个有效的 IPv4 地址 address,返回这个 IP 地址的无效化版本。 所谓无效化 IP 地址,其实就是用 "[.]" 代替了每个 "."。   示例 1: 输入:address = "1.1.1.1" 输出:"1[.]1[.]1[.]1" 示例 2: 输入:address = "255.100.50.0" 输出:"255[.]100[.]50[.]0"   提示:    

BZOJ 1108: [POI2007]天然气管道Gaz 性质分析_小结论_巧妙

Code: #include<bits/stdc++.h>#define setIO(s) freopen(s".in","r",stdin) using namespace std; int main(){ // setIO("input"); int n; long long ans=0; scanf("%d",&n); for(int i=1;i<=n;++i) { i