猫史档案馆


如何在社区证明自己是大佬?

用户:一个STUB用户_6923702一个STUB用户_6923702查看:16 回复:22 评论:16 创建时间:2021-08-14T12:39:12


——————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————

1.上网搜索C++ IO

2.将Hello World!改为我会代码

3.emotion_doge


回复

上一页1 页 / 共 1下一页
炭基生物炭基生物

https://shequ.codemao.cn/community/392207

点赞0


评论


天鹰室长不会代码吖天鹰室长不会代码吖

前排!

点赞0


评论


蒟蒻OIer1048576蒟蒻OIer1048576

#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
const int maxn = 500005;
int arr[maxn], n, m, yuan[maxn], cf[maxn];
int lowbit(int m) {
	return m & (-m);
}
void add(int i, int k) {
	while (i <= n) {
		arr[i] += k;
		i += lowbit(i);
	}
}
int qzh(int b) {
	int ans = 0;
	while (b > 0) {
		ans += arr[b];
		b -= lowbit(b);
	}
	return ans;
}
int main() {
	cin >> n >> m;
	for (int i = 1; i <= n; ++i) {
		int a; cin >> yuan[i];
		cf[i] = yuan[i] - yuan[i - 1];
		add(i, cf[i]);
	}
	for (int i = 1; i <= m; ++i) {
		int a;
		cin >> a;
		if (a == 1) {
			int b, c, d;
			cin >> b >> c >> d;
			add(c+1,-d);
			add(b,  d);
		}
		else {
			int b; cin >> b;
			cout << qzh(b) << "我会代码";
		}
	}
}

点赞0


评论


AlcalaAlcala

#include<bits/stdc++.h>
#define endl ('\n')
using namespace std;
const int maxn = 2e4 + 1e2;
int n,m;
vector<int> a[maxn];
queue<pair<int,int> > q;
bool b[maxn];
pair<int,int> d[maxn];
bool cmp(pair<int,int> x,pair<int,int> y){
	if(x.first != y.first) return x.first > y.first;
	return x.second < y.second;
}
int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
    cout<<"我会代码";
    return 0;
	cin>>n>>m;
	for(int i = 1;i <= m;i++){
		int x,y;
		cin>>x>>y;
		a[x].push_back(y);
		a[y].push_back(x);
	}
	for(int i = 1;i <= n;i++){
		d[i].second = i;
	}
	q.push(make_pair(1,0));

	while(q.size()){
		pair<int,int> p = q.front();
		q.pop();
		if(b[p.first]) continue;
		b[p.first] = 1;
		d[p.first].first = p.second;
		for(int i = 0;i < a[p.first].size();i++){
			q.push(make_pair(a[p.first][i],p.second + 1));
		}
	}
	sort(d + 1,d + n + 1,cmp);
	cout<<d[1].second<<' '<<d[1].first<<' ';
	for(int i = 1;i <= n;i++){
		if(d[i].first != d[1].first){
			cout<<i - 1;
			return 0;
		}
	}
	cout<<n;
	return 0;
}

点赞0


评论


望_庐山望_庐山

“我明白了,这是二进制!”

点赞0


评论


蒟蒻OIer1048576蒟蒻OIer1048576

#include <bits/stdc++.h>
using namespace std;
vector<int> graph[100010];
int tim[100010] , zst[100010] , v[100010] , s[100010] , gltm , st , A[100010] , m , n , a , b;
void tj(int i){
    v[i]=1;s[++st]=i;A[i]=i;
    tim[i]=zst[i]=(++gltm);
    for (int j : graph[i]) 
        if (!tim[j]) tj(j),zst[i]=min(zst[j],zst[i]),A[i]=max(A[i],A[j]);
        else if (v[j]) zst[i]=min(zst[i],tim[j]),A[i]=max(A[i],A[j]);
        else A[i]=max(A[i],A[j]);
    int it;
    if (tim[i] == zst[i]) do {
        it = s[st--];
        A[it] = max(A[it],A[i]);
        v[it] = 0;
    } while (it != i);
}
int main(){
    cin>>m>>n;
    for (int i = 1 ; i <= n ; ++ i) cin>>a>>b,graph[a].push_back(b);
    for (int i = 1 ; i <= m ; ++ i) if (!tim[i]) tj(i);
    for (int i = 1 ; i <= m ; ++ i) cout << A[i] << "我会代码";
    
}

点赞0


评论


AlcalaAlcala

#include<bits/stdc++.h>
#define endl ('\n')
using namespace std;
const int maxn = 2 * 1e5 + 1e2;
int iiiii,root,n,m,a[maxn],u[maxn],size,t[maxn][2],key[maxn],siz[maxn];
void insert(int &u,int x){
	if(u == 0){
		u = ++size,key[u] = x,siz[u] = 1;
		return;
	}
	int d = (x > key[u]);
	insert(t[u][d],x);
	siz[u]++;
}
int find(int u,int k){
	int s = siz[t[u][0]];
	if(k < s) return find(t[u][0],k);
	if(k == s) return key[u];
	return find(t[u][1],k - s - 1);
}
int order(int u,int x){
	if(u == 0) return 0;
	if(x <= key[u]) return order(t[u][0],x);
	return siz[t[u][0]] + 1 + order(t[u][1],x);
}
int qq(int root,int x){
	return find(root,order(root,x) - 1);
}
int hj(int root,int x){
	return find(root,order(root,x + 1));
}
int main(){
	ios::sync_with_stdio(false);
    cin.tie(0);
	cout.tie(0);
	cin>>m>>n;
	int now = 1;
	for(int i = 1;i <= m;i++){
		cin>>a[i];
	}
	for(int i = 1;i <= n;i++){
		cin>>u[i];
	}
	for(int i = 1;i <= m;i++){
		insert(root,a[i]);
		while(u[now] == i){
			now++;
			cout<<"我会代码"<<endl;
		}
	}
	return 0;
}

点赞0


评论


AlcalaAlcala

#include<bits/stdc++.h>
using namespace std;
struct node{
	int x,y,t;
}a[100100];
int f[1030],n,m,s,max_;
int find(int u){
	if(f[u] == u) return u;
	return f[u] = find(f[u]);
}
void merge(int u,int v){
	u = find(u);
	v = find(v);
	if(u == v) return;
	f[u] = v;
}
bool cmp(node x,node y){
	return x.t < y.t;
}
int main(){
	ios::sync_with_stdio(false);
	cin>>n>>m;
	for(int i = 1;i <= m;i++){
		cin>>a[i].x>>a[i].y>>a[i].t;
	}
	for(int i = 1;i <= n;i++){
		f[i] = i;
	}
	sort(a + 1,a + m + 1,cmp);
	for(int i = 1;i <= m;i++){
		if(find(a[i].x) != find(a[i].y)){
			s++;
			max_ = max(max_,a[i].t);
			merge(a[i].x,a[i].y);
		}
	}
	cout<<"我会代码";
	return 0;
}

点赞0


评论


蒟蒻OIer1048576蒟蒻OIer1048576

#include <bits/stdc++.h>
#define ll long long
using namespace std;
struct line{int l;int r;}toen[120]={};int en[240]={},cf[10010]={},qzh[10010]={};
int main(){
    int n,m,ans,k=0;
    cin>>n>>m;
    n++;
    ans=n;
    for(int i=1;i<=m;++i){
        cin >> toen[i].l >> toen[i].r;
        toen[i].l++;
        toen[i].r+=2;
        en[++k]=toen[i].l;
        en[++k]=toen[i].r;
    }
    en[++k]=1;en[++k]=n+1;
    sort(en+1,en+k+1);
    int len = unique(en+1,en+k+1)-en-1;
    for(int i=1;i<=m;++i){
        toen[i].l = lower_bound(en+1,en+len+1,toen[i].l)-en;
        toen[i].r = lower_bound(en+1,en+len+1,toen[i].r)-en;
        cf[toen[i].l]++;
        cf[toen[i].r]--;
    }
    for(int i=1;i<=n;++i){
        qzh[i]=qzh[i-1]+cf[i];
        if(en[i]!=0)
//        cout<<en[i]<<":"<<qzh[i]<<"\n";
        if(qzh[i]!=0)ans-=en[i+1]-en[i];
    }
    cout<<ans<<"我会代码";
}

点赞0


评论


蒟蒻OIer1048576蒟蒻OIer1048576

#include <iostream>
#include <map>
#include <vector>
#include <queue>
using namespace std;
vector<int> graph[200050], fgraph[200050];
long long magic[200050], pt[200050], dp[200050], v[200050];
int n, r;
void spfa() {
	queue<int> q;
	for (int i = 1; i <= n; ++i) q.push(i), v[i] = 1, dp[i] = magic[i];
	while (!q.empty()) {
		int u = q.front(); q.pop(); v[u] = 0;
		long long temp = pt[u];
		for (int i : graph[u]) temp += dp[i];
		if (temp >= dp[u]) continue;
		dp[u] = temp;
		for (int i : fgraph[u]) {
			if (!v[i]) {
				v[i] = 1;
				q.push(i);
			}
		}
	}
}
int main() {
	cin >> n;
	for (int i = 1; i <= n; ++i) {
		cin >> pt[i] >> magic[i] >> r;
		while (r--) {
			int a;
			cin >> a;
			graph[i].push_back(a);
			fgraph[a].push_back(i);
		}
	}
	spfa();
	cout << dp[1]<<"我会die码";
}

点赞0


评论


AlcalaAlcala

#include<bits/stdc++.h>
#define endl ('\n')
using namespace std;
const int maxn = 1e6 + 1e2;
int root,q,size_,t[maxn][2],key[maxn],siz[maxn];
void insert(int &u,int x){
	if(u == 0){
		u = ++size_,key[u] = x,siz[u] = 1;
		t[u][0] = t[u][1] = 0;
		return;
	}
	int d = (x > key[u]);
	insert(t[u][d],x);
	siz[u]++;
}
void erase(int &u,int x){
	if(u == 0) return;
	if(key[u] == x){
		if(t[u][0] == 0 || t[u][1] == 0){
			u = t[u][0] + t[u][1];
		}
		else {
			int v = t[u][1];
			while(t[v][0]){
				v = t[v][0];
			}
			key[u] = key[v];
			erase(t[u][1],key[u]);
			siz[u]--;
		}
		return;
	}
	int d = (x > key[u]);
	erase(t[u][d],x);
	siz[u]--;
}
int find(int u,int k){
	int s = siz[t[u][0]];
	if(k < s) return find(t[u][0],k);
	if(k == s) return key[u];
	return find(t[u][1],k - s - 1);
}
int order(int u,int x){
	if(u == 0) return 0;
	if(x <= key[u]) return order(t[u][0],x);
	return siz[t[u][0]] + 1 + order(t[u][1],x);
}
int qq(int root,int x){
	return find(root,order(root,x) - 1);
}
int hj(int root,int x){
	return find(root,order(root,x + 1));
}
int vec[maxn], sz;
void dfs(int u) {
  if(t[u][0]) dfs(t[u][0]);
  vec[sz++] = key[u];
  if(t[u][1]) dfs(t[u][1]);
}
int build(int l,int r){
	int u = ++size_,mid = (l + r) / 2;
	key[u] = vec[mid],siz[u] = 1,t[u][0] = t[u][1] = 0;
	if(l < mid) t[u][0] = build(l, mid - 1),siz[u] += siz[t[u][0]];
	if(r > mid) t[u][1] = build(mid + 1, r),siz[u] += siz[t[u][1]];
	return u;
}
int rebuild(int root){
	if(!root) return 0;
	sz = 0;
	dfs(root);
	size_ = 0;
	return build(0,sz - 1);
}
int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	insert(root,-2147483647);
	insert(root,2147483647);
	cin>>q;
	int kkk = sqrt(q);
	for(int i = 1;i <= q;i++){
		if(i % kkk == 0) root = rebuild(root);
		int k,x;
		cin>>k>>x;
		if(k == 1) insert(root,x);
		if(k == 2) erase(root,x);
		if(k == 3) cout<<order(root,x)<<endl;
		if(k == 4) cout<<find(root,x)<<endl;
		if(k == 5) cout<<qq(root,x)<<endl;
		if(k == 6) cout<<hj(root,x)<<endl;
	}
	return 0;
}

点赞0


评论


韵律源点Arcaea韵律源点Arcaea

评论区神仙打架

点赞0


评论


fx已退fx已退

#include <bits/stdc++.h>
#include "Binary tree.h"
using namespace std;
int minDeapth(TreeNode* root){
	if(!root) return 0;
	queue<TreeNode*> q;
	q.push(root);
	int depth=1;
	while(!q.empty()){
		int sz=q.size();
		for(int i=0;i<sz;i++){
			TreeNode* cur=q.front();
			q.pop();
			if(!cur->left && !cur->right)
				return depth;
			if(cur->left)
				q.push(cur->left);
			if(cur->right)
				q.push(cur->right);
		}
		depth++;
	}
	return depth;
}

BFS

点赞0


评论


CBSCBS

mx路过

点赞0


评论


ofetofet

public class fibonacci {
	public static void main(String[] args){
		System.out.println("fibonacci!");
		int a = 0, b = 1, A;
		for(int i = 0;i < 10;i++){
			System.out.println(a);
			A = a; a = b; b += A;
		}
	}
}

一个简单的jvav(没错,我是故意把java输入成jvav的)。

(其实简单是因为我真的不会独立写更复杂的了)

点赞1


评论


离开的十五分之六老咸鱼离开的十五分之六老咸鱼

你会jvav吗

点赞0


评论


若隐若现的北汐若隐若现的北汐

我不会代码

点赞0


评论


低熵体_鸽者低熵体_鸽者

while True:
    print("我会个der的java")

点赞0


评论


thisisPianothisisPiano

import sys, pickle,datetime
from PyQt5 import QtCore, QtGui, QtWidgets, uic

formclass = uic.loadUiType("virtualpet.ui")[0]

class VirtualPetWindow(QtWidgets.QMainWindow, formclass):
    def __init__(self, parent=None):
        QtWidgets.QMainWindow.__init__(self, parent)
        self.setupUi(self)
        self.doctor = False
        # Initializes values
        self.walking = False
        self.sleeping = False
        self.playing = False
        self.eating = False
        self.time_cycle = 0
        self.hunger = 0
        self.happiness  = 8
        self.health = 8
        self.forceAwake = False
        # Lists images for ani喵s
        self.sleepImages = ["sleep1.gif","sleep2.gif","sleep3.gif",
                            "sleep4.gif"]
        self.eatImages = ["eat1.gif", "eat2.gif"]
        self.walkImages = ["walk1.gif", "walk2.gif", "walk3.gif",
                           "walk4.gif"]
        self.playImages = ["play1.gif", "play2.gif"]
        self.doctorImages = ["doc1.gif", "doc2.gif"]
        self.nothingImages  = ["pet1.gif", "pet2.gif", "pet3.gif"]

        self.imageList = self.nothingImages
        self.imageIndex = 0

        # Connects event handlers for toolbar buttons
        self.actionStop.triggered.connect(self.stop_Click)
        self.actionFeed.triggered.connect(self.feed_Click)
        self.actionWalk.triggered.connect(self.walk_Click)
        self.actionPlay.triggered.connect(self.play_Click)
        self.actionDoctor.triggered.connect(self.doctor_Click)

        # Sets up timers
        self.myTimer1 = QtCore.QTimer(self)
        self.myTimer1.start(500)
        self.myTimer1.timeout.connect(self.ani喵_timer)
        self.myTimer2 = QtCore.QTimer(self)
        self.myTimer2.start(5000)
        self.myTimer2.timeout.connect(self.tick_timer)

        filehandle = True
        # Tries to open pickle file
        try:
            file = open("savedata_vp.pkl", "rb")
        except:
            filehandle = False
        if filehandle:
            save_list = pickle.load(file)  # Reads from pickle file if open
            file.close()
        else:
            save_list = [8, 8, 0, datetime.datetime.now(), 0]  # Uses default values if pickle file not open
        # Pulls individual values out of list
        self.happiness = save_list[0]
        self.health    = save_list[1]
        self.hunger    = save_list[2]
        timestamp_then = save_list[3]
        self.time_cycle = save_list[4]

        # Checks how long since last run
        difference = datetime.datetime.now() - timestamp_then
        ticks = int(difference.seconds / 50)
        for i in range(0, ticks):
            # Simulates all ticks that happened during down time
            self.time_cycle += 1
            if self.time_cycle == 60:
                self.time_cycle = 0
            if self.time_cycle <= 48:  # Awake
                self.sleeping = False
                if self.hunger < 8:
                    self.hunger += 1
            else:  # Sleeping
                self.sleeping = True
                if self.hunger < 8 and self.time_cycle % 3 == 0:
                    self.hunger += 1
            if self.hunger == 7 and (self.time_cycle % 2 ==0) \
                                and self.health > 0:
                self.health -= 1
            if self.hunger == 8 and self.health > 0:
                self.health -=1
        # Uses correct ani喵—awake or sleeping
        if self.sleeping:
            self.imageList = self.sleepImages
        else:
            self.imageList = self.nothingImages

    def sleep_test(self):
        # Checks if pet is sleeping before doing an action
        if self.sleeping:
            result = (QtWidgets.QMessageBox.warning(self, 'WARNING',  # Type of dialog
"Are you sure you want to wake your pet up?  He'll be unhappy about it!",
                    QtWidgets.QMessageBox.Yes | QtWidgets.QMessageBox.No,  # Buttons to show
                    QtWidgets.QMessageBox.No))  # Default button

            if result == QtWidgets.QMessageBox.Yes:
                self.sleeping = False
                self.happiness -= 4
                self.forceAwake = True
                return True
            else:
                return False
        else:
            return True

    # The doctor button event handler
    def doctor_Click(self):
        if self.sleep_test():
            self.imageList = self.doctorImages
            self.doctor = True
            self.walking = False
            self.eating = False
            self.playing = False

    # The feed button event handler
    def feed_Click(self):
        if self.sleep_test():
            self.imageList = self.eatImages
            self.eating = True
            self.walking = False
            self.playing = False
            self.doctor = False

    # The play button event handler
    def play_Click(self):
        if self.sleep_test():
            self.imageList = self.playImages
            self.playing = True
            self.walking = False
            self.eating = False
            self.doctor = False

    # The walk button event handler
    def walk_Click(self):
        if self.sleep_test():
            self.imageList = self.walkImages
            self.walking = True
            self.eating = False
            self.playing = False
            self.doctor = False

    # The stop button event handler
    def stop_Click(self):
        if not self.sleeping:
            self.imageList = self.nothingImages
            self.walking = False
            self.eating = False
            self.playing = False
            self.doctor = False

    def animation_timer(self):
        # The animation timer (every 0.5 sec) event handler
        if self.sleeping and not self.forceAwake:
            self.imageList = self.sleepImages
        self.imageIndex += 1
        if self.imageIndex >= len(self.imageList):
            self.imageIndex = 0
        icon = QtGui.QIcon()
        # Updates pet’s image (animation)
        current_image = self.imageList[self.imageIndex]
        icon.addPixmap(QtGui.QPixmap(current_image),
                       QtGui.QIcon.Disabled, QtGui.QIcon.Off)
        self.petPic.setIcon(icon)
        self.progressBar_1.setProperty("value", (8-self.hunger)*(100/8.0))
        self.progressBar_2.setProperty("value", self.happiness*(100/8.0))
        self.progressBar_3.setProperty("value", self.health*(100/8.0))

    def tick_timer(self):  # Start of main 5 sec timer event handler
        # Checks if sleeping or awake
        self.time_cycle += 1
        if self.time_cycle == 60:
            self.time_cycle = 0
        if self.time_cycle <= 48 or self.forceAwake:
            self.sleeping = False
        else:
            self.sleeping = True
        if self.time_cycle == 0:
            self.forceAwake = False

        if self.doctor:
            # Adds or subtracts units depending on activity
            self.health += 1
            self.hunger += 1
        elif self.walking and (self.time_cycle % 2 == 0):
            self.happiness += 1
            self.health += 1
            self.hunger += 1
        elif self.playing:
            self.happiness += 1
            self.hunger += 1
        elif self.eating:
            self.hunger -= 2
        elif self.sleeping:
            if self.time_cycle % 3 == 0:
                self.hunger += 1
        else:
            self.hunger += 1
            if self.time_cycle % 2 == 0:
                self.happiness -= 1
        # Makes sure values are not out of range
        if self.hunger > 8:  self.hunger = 8
        if self.hunger < 0:  self.hunger = 0
        if self.hunger == 7 and (self.time_cycle % 2 ==0) :
            self.health -= 1
        if self.hunger == 8:
            self.health -=1
        if self.health > 8:  self.health = 8
        if self.health < 0:  self.health = 0
        if self.happiness > 8:  self.happiness = 8
        if self.happiness < 0:  self.happiness = 0
        # Updates progress bars
        self.progressBar_1.setProperty("value", (8-self.hunger)*(100/8.0))
        self.progressBar_2.setProperty("value", self.happiness*(100/8.0))
        self.progressBar_3.setProperty("value", self.health*(100/8.0))

    def closeEvent(self, event):
        # Saves status and timestamp to pickle file
        file = open("savedata_vp.pkl", "wb")  # Line-continuation character
        save_list = [self.happiness, self.health, self.hunger, \
                     datetime.datetime.now(), self.time_cycle]
        pickle.dump(save_list, file)
        event.accept()

    def menuExit_selected(self):
        self.close()

app = QtWidgets.QApplication(sys.argv)
myapp = VirtualPetWindow()
myapp.show()
app.exec_()

点赞0


评论


鸽毛鸽毛

center_image这张图足以证明了

点赞0


评论


不知道该叫啥的一只萌新不知道该叫啥的一只萌新

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define MAX 1000001
int bigchengfa(int *sum,int *a,int *b,int la,int lb)
{
    int i,j,lsum = 0 ;
    memset(sum,0,sizeof(sum));
    for(i=1 ; i<= la ; i++) 
        for(j=1,lsum=i-1; j<= lb ; j++)
            sum[++lsum] += b[j] * a[i] ;
    for(i=1 ; i<= lsum ; i++)
    if (sum[i] >= 10)
    {
        if ( sum[lsum] >= 10)
        lsum ++ ;
        sum[i+1] += sum[i] / 10 ;
        sum[i] %= 10 ;
    }
    return lsum ;
}
int main(void)
{
    int a[MAX]={0},b[MAX]={0},sum[MAX*2]={0} ;
    int la=0,lb=0,lsum=0;
    int i,j ;
    char sa[MAX],喵[MAX] ;
    scanf("%s %s",sa,喵);
    la = strlen(sa);
    lb = strlen(喵);
    for(i=1,j=la-1; i<= la ; i++,j--)
        a[i] = sa[j] - '0' ;
    for(i=1,j=lb-1; i<= lb ; i++,j--)
        b[i] = 喵[j] - '0' ;
    lsum = bigchengfa(sum,a,b,la,lb) ;
    for(i=lsum ; i> 0 ; i--)
        printf("%d",sum[i]);
    printf("\n");
    return 0 ;
}

点赞0


评论


ofetofet

Brainfuck!

++++++++++++++++++++++43从0到ord(加号)+++++++++++++++++++++
>,>,>,>,
<<< --------------------48从ord('0')到0----------------------------
[>>>>]<<<<<
[
    >+++++++++++++++++++48从0到ord('0')+++++++++++++++++++++++++++++.
    --------------------48从ord('0')到0----------------------------<<<<<
]
>>>>>>.-----------------48从ord('0')到0-------------------------------
<<.>>>------------------48从ord('0')到0------------------------------
[>>]<<<<<
[
    >>>++++++++++++++++++++48从0到ord('0')++++++++++++++++++++++++++++.
    ------------------48从ord('0')到0------------------------------<<<<<
]
>>>>>>.----------------48从ord('0')到0--------------------------------


<[->+++++十+++++<]
<[->>+<<]
<[->>>+++++十+++++<<<]
>>> >+++++十+++++ >+++++十+++++ >++++十++++++ >>+
<<<<<


[
    ->>>-
    [>]>>
    [
        <<+++++十+++++<-
        [>>]>>>
        [
            <<<+++++十+++++<-
            >>>>>>
        ]
        <
    ]
    <<<<<<
]


<<<<+++++++++18从ord(加号)到ord('=')+++++++++.
>+++++十+++++
>+++++十+++++
>+++++十+++++
>>>>
[[-<<<<->>>>]<]
<<<


[>>>]<<<<
[
    >++++++++++++++++++++++++48从0到ord('0')++++++++++++++++++++++++.
    >++++++++++++++++++++++++48从0到ord('0')++++++++++++++++++++++++.
    >++++++++++++++++++++++++48从0到ord('0')++++++++++++++++++++++++.>
]
>>>
[
    >>
    [>>]<<<<
    [
        >>+++++++++++++++++++++++++48从0到ord('0')++++++++++++++++++++++.
        >++++++++++++++++++++++++48从0到ord('0')++++++++++++++++++++++++.>
    ]
    >>
    [>>>++++++++++++++++++++++48从0到ord('0')++++++++++++++++++++++++++.>]
]

两位数加法,先数字输入a,b,c,d,就输出ab+cd=(ab+cd)

重点:输出时省略数前面的0。

举例:(输入---输出)

5678---56+78=134

1234---12+34=46

0713---7+13=20

0702---7+2=9

0000---0+0=0

注:未设置输入保护,请按规则输入,否则会出错。

还可以再改进的,但是算了;我要开发Brainfuck自编译程序(已经有算法了),然后这之前我要自己写一个更好的Brainfuck编译器。

点赞0


评论