%d* c nyist 96

來源:互聯網
上載者:User

標籤:os   io   資料   for   ar   時間   amp   ios   

#include<iostream>
#include<cstdio>
#include<cstring>

using namespace std;

int main()
{
int n,i;
char s[100];
char s1[100],s2[100],s3[100];
scanf("%d%*c",&n);

for(i=1;i<=n;i++)

{
gets(s1);
puts(s1);

}
}

 

 

題目96
題目資訊運行結果本題排行討論區n-1位元
時間限制:3000 ms | 記憶體限制:65535 KB
難度:1
描述
已知w是一個大於10但不大於1000000的不帶正負號的整數,若w是n(n≥2)位的整數,則求出w的後n-1位的數。

輸入
第一行為M,表示測試資料群組數。
接下來M行,每行包含一個測試資料。
輸出
輸出M行,每行為對應行的n-1位元(忽略首碼0)。如果除了最高位外,其餘位都為0,則輸出0。
範例輸入
4
1023
5923
923
1000範例輸出
23
923
23
0

 

// 用字串:
#include <iostream>
#include <cstring>
using namespace std;
int main()
{ char s[10];
int i,n,k,m,j;
cin>>m;
while(m--)
{
cin>>s;
k=strlen(s);
for(i=1;i<k;i++)
if(s[i]!=‘0‘)break;
if(i==k){ cout<<0<<endl;continue; }

for(j=i;j<k;j++)
cout<<s[j];
cout<<endl;
}
return 0;
}


#include<stdio.h>
int main()
{
int n;
int m;
scanf("%d",&n);
while(n--)
{
scanf("%d",&m);
if(m==1000000||m==100000||m==10000||m==1000||m==100||m==10)
m=0;
if(m>10&&m<100) m%=10;
else if(m<1000) m%=100;
else if(m<10000) m%=1000;
else if(m<100000) m%=10000;
else if (m<1000000) m%=100000;
printf("%d\n",m);
}
return 0;
}

 

 

 

 

 

 

#include<cstdio>
int main()
{
int n,m;
scanf("%d",&n);
while(n--)

{
scanf("\n%*c%d",&m); //輸入的內容去掉第一位 :如果輸入845,則M裡面放著45
printf("%d\n",m);

}
}

 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.