首页
题库
面试
求职
学习
竞赛
More+
所有博客
搜索面经/职位/试题/公司
搜索
我要招人
去企业版
登录 / 注册
首页
>
试题广场
>
IP地址转化
[编程题]IP地址转化
热度指数:900
时间限制:C/C++ 1秒,其他语言2秒
空间限制:C/C++ 256M,其他语言512M
算法知识视频讲解
IP地址是一个用 '.' 隔开的四段数字,每段的大小是
。请你把 IP 地址转换成一个整数。(IPv4)
例如, 114.55.207.244 的二进制表示是 01110010 00110111 11001111 11110100 ,其十进制表示是 7590617063
示例1
输入
"114.55.207.244"
输出
"1916260340"
示例2
输入
"0.0.0.1"
输出
"1"
马上挑战
算法知识视频讲解
提交运行
算法知识视频讲解
添加笔记
求解答(0)
邀请回答
收藏(11)
分享
纠错
提交结果有问题?
0个回答
7篇题解
添加回答
这道题你会答吗?花几分钟告诉大家答案吧!
提交观点
问题信息
字符串
模拟
难度:
0条回答
11收藏
2268浏览
热门推荐
通过挑战的用户
查看代码
苏皖
2022-09-15 18:46:04
好20110
2022-09-15 12:42:44
maple-s...
2022-09-14 14:27:15
牛客46766...
2022-09-13 19:41:19
孙利showshow
2022-09-11 11:47:17
相关试题
有两个文件context.txt和...
去哪儿
模拟
评论
(4)
一个10*10的矩阵(可以理解为棋...
去哪儿
模拟
评论
(0)
一个文件里有10万个随机正整数,按...
去哪儿
堆
模拟
评论
(4)
设某二叉树的先序遍历序列为abdg...
树
评论
(1)
2022 诺瓦科技 Perl re...
perl
System Verilog
评论
(1)
扫描二维码,关注牛客网
意见反馈
下载牛客APP,随时随地刷题
import java.util.*; public class Solution { /** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * * @param ip string字符串 * @return string字符串 */ public String IPtoNum (String ip) { // write code here } }
class Solution { public: /** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * * @param ip string字符串 * @return string字符串 */ string IPtoNum(string ip) { // write code here } };
#coding:utf-8 # # 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 # # # @param ip string字符串 # @return string字符串 # class Solution: def IPtoNum(self , ip ): # write code here
using System; using System.Collections.Generic; class Solution { /** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * * @param ip string字符串 * @return string字符串 */ public string IPtoNum (string ip) { // write code here } }
/** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * * @param ip string字符串 * @return string字符串 */ function IPtoNum( ip ) { // write code here } module.exports = { IPtoNum : IPtoNum };
# # 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 # # # @param ip string字符串 # @return string字符串 # class Solution: def IPtoNum(self , ip: str) -> str: # write code here
package main //import "fmt" /** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * * @param ip string字符串 * @return string字符串 */ func IPtoNum( ip string ) string { // write code here }
/** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * * @param ip string字符串 * @return string字符串 */ char* IPtoNum(char* ip ) { // write code here }
# # 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 # # # @param ip string字符串 # @return string字符串 # class Solution def IPtoNum(ip) # write code here end end
object Solution { /** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * * @param ip string字符串 * @return string字符串 */ def IPtoNum(ip: String): String = { // write code here } }
object Solution { /** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * * @param ip string字符串 * @return string字符串 */ fun IPtoNum(ip: String): String { // write code here } }
import java.util.*; public class Solution { /** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * * @param ip string字符串 * @return string字符串 */ public String IPtoNum (String ip) { // write code here } }
/** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * * @param ip string字符串 * @return string字符串 */ export function IPtoNum(ip: string): string { // write code here }
public class Solution { /** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * * @param ip string字符串 * @return string字符串 */ func IPtoNum ( _ ip: String) -> String { // write code here } }
struct Solution{ } impl Solution { fn new() -> Self { Solution{} } /** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * * @param ip string字符串 * @return string字符串 */ pub fn IPtoNum(&self, ip: String) -> String { // write code here } }
"114.55.207.244"
"1916260340"
"0.0.0.1"
"1"