国内首个ChatGPT镜像系统?辅助写代码真方便

hatGPT
美国OpenAI研发的聊天机器人程序,于2022年11月30日发布。ChatGPT是人工智能技术驱动的自然语言处理工具,它能够通过学习和理解人类的语言来进行对话,还能根据聊天的上下文进行互动,真正像人类一样来聊天交流,甚至能完成撰写邮件、视频脚本、文案、翻译、代码等任务。

chat=闲聊,聊天的意思
GPT=Generative Pretrained Transformer(生成预训练变换器)的缩写
chatGPT=聊天训练
组合解释=智能的对话聊天工具(由美国OpenAI研发,最近微软投了100亿刀)

目前ChatGPT未对中国大陆开放,注册需要境外手机号,非常不方便。之前试过几个国内的镜像站均非常不稳定,有对话条数限制,又么有一堆广告;有的甚至先免费后收费,先提供有限数次的免费对话额度,之后继续使用需充值,充值额度还很可观,比如: 某个网站上的收费9.99元/20次(三个月有效)、99.99元/1300次(半年有效)、199.99元/3000次(一年有效)、999.99元/无限次(一年内有效)。千万别因好奇去充值当冤大头。

今天发现一个网址很干净,我用了好久都没问题,希望它能维持下去…

网址
https://6om.net/

国内首个ChatGPT镜像系统?辅助写代码真方便

还有一个AI写作可以用
国内首个ChatGPT镜像系统?辅助写代码真方便

网站首页非常清爽
国内首个ChatGPT镜像系统?辅助写代码真方便
编程测试
找一些编程题目,来测试一下chatGPT的编程能力。

  1. 我想用golang实现二叉树前序,请你帮我写一下代码。
package main

import "fmt"

type TreeNode struct {
	Val   int
	Left  *TreeNode
	Right *TreeNode
}

func preorderTraversal(root *TreeNode) {
	if root == nil {
		return
	}
	fmt.Printf("%d ", root.Val)
	preorderTraversal(root.Left)
	preorderTraversal(root.Right)
}

func main() {
	root := &TreeNode{Val: 1}
	root.Left = &TreeNode{Val: 2}
	root.Right = &TreeNode{Val: 3}
	root.Left.Left = &TreeNode{Val: 4}
	root.Left.Right = &TreeNode{Val: 5}

	preorderTraversal(root)
}

2.给定一个字符串数组,打印数组中的所有词。请用C++代码实现

#include <iostream>
using namespace std;
int main()
{
    string arr[] = {"Hello", "World", "!"};
    int size = sizeof(arr) / sizeof(arr[0]);
    for (int i = 0; i < size; i++)
    {
        cout << arr[i] << " ";
    }
    return 0;
}

3.零尾数个数
如下的10行数据,每行有10个整数,请你求出它们的乘积的末尾有多少个零?请用C代码实现

5650 4542 3554 473 946 4114 3871 9073 90 4329
2758 7949 6113 5659 5245 7432 3051 4434 6704 3594
9937 1173 6866 3397 4759 7557 3070 2287 1453 9899
1486 5722 3135 1170 4014 5510 5120 729 2880 9019
2049 698 4582 4346 4427 646 9742 7340 1230 7683
5693 7015 6887 7381 4172 4341 2909 2027 7355 5649
6701 6645 1671 5978 2704 9926 295 3125 3878 6785
2066 4247 4800 1578 6652 4616 1113 6205 3264 2915
3966 5291 2904 1285 2193 1428 2265 8730 9436 7074
689 5510 8243 6114 337 4096 8199 7313 3685 211

#include <stdio.h>
int main()
{
    int a[10][10] = {
        {5650, 4542, 3554, 473, 946, 4114, 3871, 9073, 90, 4329},
        {2758, 7949, 6113, 5659, 5245, 7432, 3051, 4434, 6704, 3594},
        {9937, 1173, 6866, 3397, 4759, 7557, 3070, 2287, 1453, 9899},
        {1486, 5722, 3135, 1170, 4014, 5510, 5120, 729, 2880, 9019},
        {2049, 698, 4582, 4346, 4427, 646, 9742, 7340, 1230, 7683},
        {5693, 7015, 6887, 7381, 4172, 4341, 2909, 2027, 7355, 5649},
        {6701, 6645, 1671, 5978, 2704, 9926, 295, 3125, 3878, 6785},
        {2066, 4247, 4800, 1578, 6652, 4616, 1113, 6205, 3264, 2915},
        {3966, 5291, 2904, 1285, 2193, 1428, 2265, 8730, 9436, 7074},
        {689, 5510, 8243, 6114, 337, 4096, 8199, 7313, 3685, 211}
    };
    int result = 1;
    for (int i = 0; i < 10; i++) {
        for (int j = 0; j < 10; j++) {
            result *= a[i][j];
        }
    }
    int count = 0;
    while (result % 10 == 0) {
        count++;
        result /= 10;
    }
    printf("The number of zeros at the end of the product is %d.\n", count);
    return 0;
}

4.四数之和
给定一个包含 n 个整数的数组 nums 和一个目标值 target,判断 nums 中是否存在四个元素 a,b,c 和 d ,使得 a + b + c + d 的值与 target 相等?找出所有满足条件且不重复的四元组,用python代码实现。

def fourSum(nums, target):
    res = []
    nums.sort()
    for i in range(len(nums)-3):
        if i > 0 and nums[i] == nums[i-1]:
            continue
        for j in range(i+1, len(nums)-2):
            if j > i+1 and nums[j] == nums[j-1]:
                continue
            l, r = j+1, len(nums)-1
            while l < r:
                s = nums[i] + nums[j] + nums[l] + nums[r]
                if s == target:
                    res.append([nums[i], nums[j], nums[l], nums[r]])
                    while l < r and nums[l] == nums[l+1]:
                        l += 1
                    while l < r and nums[r] == nums[r-1]:
                        r -= 1
                    l += 1
                    r -= 1
                elif s < target:
                    l += 1
                else:
                    r -= 1
    return res

5.字符串编码
问题描述
小明发明了一种给由全大写字母组成的字符串编码的方法。
对于每一个大写字母,小明将它转换成它在 26 个英文字母中序号,即 A → 1, B → 2, … Z →26。
这样一个字符串就能被转化成一个数字序列:比如 ABCXYZ → 123242526。
现在给定一个转换后的数字序列,小明想还原出原本的字符串。
当然这样的还原有可能存在多个符合条件的字符串。
小明希望找出其中字典序最大的字符串。
请用C++代码来实现:

输入格式
一个数字序列。

输出格式
一个只包含大写字母的字符串,代表答案

样例输入
123242526
样例输出
LCXYZ

#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
int main() {
    string s;
    cin >> s;
    string ans = "";
    for (int i = 0; i < s.length(); i++) {
        int num = s[i] - '0';
        char c = 'A' + num - 1;
        ans += c;
    }
    sort(ans.begin(), ans.end(), greater<char>());
    cout << ans << endl;
    return 0;
}

文章出处登录后可见!

已经登录?立即刷新

共计人评分,平均

到目前为止还没有投票!成为第一位评论此文章。

(0)
社会演员多的头像社会演员多普通用户
上一篇 2023年3月18日
下一篇 2023年3月18日

相关推荐