为什么TLE了(其实我明白只是叫大家别像我一样用循环做A+B

P1001 A+B Problem

CyaNgw_DyG @ 2021-08-13 20:09:25

#include<bits/stdc++.h>
using namespace std;
int main(){
    int a,b;
    cin>>a>>b;
    if(b<=0)for(int i=0;i>b;i--)a+=-1;
    else for(int i=1;i<=b;i++)a+=1;
    cout<<a;
} 

by 零殇 @ 2021-08-13 20:19:54

@dyg_Teaf_offorz

负权值跑spfa它不香吗/cg


by Union_of_Britain @ 2021-08-13 20:37:31

珂以倍增吧


by pzj666 @ 2021-08-13 21:01:59

@Gorilla 你用快读快写试试?


by impuk @ 2021-08-13 21:19:26

nms;


by Zvelig1205 @ 2021-08-13 21:26:38

A+B Problem


by Wang1006 @ 2021-08-26 20:50:40

。。。记录

#include<iostream>
using namespace std;
int main(){
intt:
    int a,b;
init:
    cin>>a>>b;
out:
    cout<<a+b;
    goto end;
rp:
    while(1)cout<<"rp++";
end:
    return 0;
}

by CyaNgw_DyG @ 2021-08-27 08:57:52

Orz


by Wang1006 @ 2021-08-28 15:09:15

orz


上一页 |