另外,我猜你连题目都没读过。题目中既说“以0 0结束”又说“N…表示操作次数”,信息冗余了,“样例输入”也中没有“0 0”
程序代码:
#include <stdio.h> int main( void ) { unsigned n; unsigned long long x; unsigned opt[100]; unsigned long long opd[100]; scanf( "%u%llu", &n, &x ); for( unsigned i=0; i!=n; ++i ) scanf( "%u%llu", &opt[n-i-1], &opd[n-i-1] ); for( unsigned i=0; i!=n; ++i ) { switch( opt[i] ) { case 1: x-=opd[i]; break; case 2: x+=opd[i]; break; case 3: x/=opd[i]; break; case 4: x*=opd[i]; break; } } printf( "%llu\n", x ); }