0 like 0 dislike
4.6k views

Alex傳送郵件時都會先進行加密處理,加密的方式是每個字元加上某一個整數K(字元一定都在ASCII碼中可列印的範圍內)。

Input

每筆測試資料有1個字串不超過1000個字元。內容會包含"Alex",且中間不會出現換行。

Output

對每一測試資料,請輸出解密後的信件。

Sample Input

Ghdu#Pu1#Doh{/L#dp#zulwlqj#wklv#ohwwhu#wr#lqirup#|rx#wkdw#L#kdyh#wr#wdnh#d#vlfn#ohdyh#iurp#frxuvh#gxh#wr#wkh#ihyhu1#Vruu|#iru#dq|#lqfrqyhqlhqfh#fdxvhg#e|#p|#devhqfh1#L#zrxog#uhylhz#wkh#pdwhuldo#ehiruh#qh{w#frxuvh1#Ihho#iuhh#wr#frqwdfw#ph#li#|rx#qhhg#ixuwkhu#yhulilfdwlrq#iurp#p|#grfwru1#Wkdqn#|rx#iru#|rxu#lpphgldwh#dwwhqwlrq#wr#wklv#pdwwhu1

Sample Output

Dear Mr. Alex,I am writing this letter to inform you that I have to take a sick leave from course due to the fever. Sorry for any inconvenience caused by my absence. I would review the material before next course. Feel free to contact me if you need further verification from my doctor. Thank you for your immediate attention to this matter.

 

 

[Normal] Coding (C) - asked in 2016-1 程式設計(一)AC by (-126 points)
ID: 19222 - Available when: Unlimited - Due to: Unlimited

reshown by | 4.6k views

23 Answers

0 like 0 dislike
Hidden content!
#include <stdio.h>

#include <stdlib.h>

#include <ctype.h>

#include <string.h>





int main()

{

    char a[5000];

    int i,c=0;
* * * ** *** ** ** ** * * * **** * ** *
* * * *** * * ** * **
*** * * ** ** ** * * * ** * ** * ** * *** **
* * ** ****** ** *** * *** ** *** ** ***** ** * **** * * * * ** ****** ** -7){
** * *** * ** *** * *** * * * * * * *** ** **** ** * * ***** * *** * * * * * *** * **
* * **** ** *** * ** * *** * ** * * ** *** * ** *** * * * ** ** ** *** ***** ***** * * * ** ** **** ** *
****** * * ** * * *** ** ** * * * * ** * * ** ** ** ** ** * *** *** *** ** ** ** * * * ** * ********
* * ***** ****** **** ** * * ** ** *** ** ** * *** **** * * * **** * * ***** ** ***
* * ** ******** * * ********* ** ** ***** * ** *** ** * ** *
* *** ** * * ** * * ** * ** ** * ** * ** *

    }
* * * * * ** * * * * ** *** * * ** *
* * *** * ** **** * ****** *** ** * *** *** * **** * * ****

    }
* ** ***** * ** * * * * * 0;

}
answered by (-158 points)
0 like 0 dislike
Hidden content!
#include <stdio.h>

#include <stdlib.h>

#include <ctype.h>

#include <string.h>





int main()

{

    char a[5000];

    int i,c=0;
* * * * * * **** ** ** * * * * **
***** ** * *** * *** ** * * ** **** *
** * ** * * * ** * ** * ** ******* ****** *
* ** ** *** *** ** ** ** *** * * *** ** *** * ***** **** *** ****** -7){
**** * *** * * **** * *** * ** * * * **** * ** * ** * *** ** ** * * * * * ** * *** * ** ** * * **** * *
***** ** ****** **** *** *** * *** * ** ******** * **** *** ** * * * * * ******* ** ** ******* * * * * * ** * ** * *
* *** **** * * ******* ** * * * * ** * * * ** ** * ** *** * * *** * * * * * * * * *** * * * * * * * ** * ** * **
* **** * * * ** * * * *** * **** * * ** *********** * * *** ** * * ** *** * **** * *
*** ** ** * *** * * **** * * * * * * ** ***** * * * *** *** * **
* * ** * ** * ** ** ** ** * *** ** ** * *

    }
* ** * * ***** * *** *** * * * * * * * * *
*** * ***** * **** * ** ** ****** ** **** ** * ** ** * ******* * * * *

    }
** **** *** *** ** 0;

}
answered by (-158 points)
0 like 0 dislike
Hidden content!
#include <stdio.h>

#include ** ** ** *

#include <string.h>



int main (void)

{

  
* ******* * a[300],b[300],c[300];

  
* *** * i,len_a,len_b,len_c;

  
*** * **** * sum,sum_a = 0,sum_b = 0,sum_c = 0;

  
* * * *** fault_a = 0,fault_b = 0,fault_c = 0;

  
* *** * ** * ** * %s %s",a,b,c);

  
* * ** **** * = strlen(a);

  
** ** *** ** = strlen(b);

  
***** * * ** * * * = strlen(c);

  

  for (i = 0;i < len_a;i++){
* * *** * * *** * *
** *** *** *** * **** * ** * (a[i] == 65 || a[i] == 97)
** * * ** * * * * *
** *** * * * * ** ** * * *** ** **** * * * *** += 1;
* *** * * ** **** ***** ** ** ** *** * *
* ** * * * * ** * * **** * *** *** if (a[i] == '4'){
** * ** ***** ** * * * ** ******
** * *** * * * * * ** ** *** * ***** ** ** *** * ** (a[i+1] == '4'){
* * *** *** * * * ***** * ** ** * *** * **** * ** * * * * * * **** * ** *
** ** ** * * ** ** * * * * ****** *** * * * * *** * * * * * ** ** ** * *** * * * (a[i+2] == '4')
* * * * ** ** * * ** ** * **** ****** ** * *** * *** * * * * * ** ***** ** * ** *
*** ** *** *** ** *** * *** ** * * * * *** *** **** * * * * ** ***** ** * ***** * * * ** ***** = 1;
*** ***** * * *** ** ** ****** * * ** * * * * ** *** * ** * *** * ** * *** * * * *** ** * * * * ****
* ** * * * *** * ***** ** * *** ** ****** * ** *** *** ***** * * *** ** * *
* * ** ** * * * * * ** * ** ***** **** ** ** * ** ***


****** ** * ** ** * * ** ** * ***



  }  

  

  for (i = 0;i < len_b;i++){
** * *** *** * * ** ** *** *
* ** ** * * *** ** * ** ** **** (b[i] == 66 || b[i] == 98)
* ***** ***** * * * * *** ** **
**** *** ** * * ** * ** ****** ** * ** ** * ** * * ** * += 1;
* *** ** * * ** * ****** **** ** ** * ** ** ** *** *** **
* ** * * * * **** * ****** if (b[i] == '4'){
*** * * * **** ** * * * * ** ** *****
** ** * * * * *** ** *** ** *** **** ** * * ** * **** *** (b[i+1] == '4'){
* **** * ** *** *** ** **** * * *** * *** * * ** * * * * *** * ** *
** ** ***** ******* **** * ***** ****** * *** **** ** ** ****** ***** *** * * * ** (b[i+2] == '4')
** ** ******** *** * * ** ** ******* ** * * * * * *** *** *** * ***** ** *
** ***** * * * **** * * ** ***** * * * *** ** * * * * * ** ****** ** * *** ** * *** * * ****** ** ***** ** * * ****** * ** = 1;
* * ** ** * ** * ** * *** ** *** * * * ** ** * ** * ** ** * ** * ** ** **** ** *** ** **** * *
******* * * * * * **** *** * * ** *** ** **** * * * **
*** * * * * * ** * * ***** **** * ** * **** * ********** * * *
** * * ** *** * * **** * *
* * * *** * * * *** ** **** * **

  }

  
** ** **** ** (i = 0;i < len_c;i++){
**** ****** * * * *** ** * ** ** ** *
****** * **** * ** * ******** * ** (c[i] == 67 || c[i] == 99)
** *** * ** * * * *** **** **
** * * * *** * ** * ** * ** * * ** ** **** ** += 1;
* * * **** * * * * ******** ** * *** ***** **
* * * ** * ************ ******** ***** ** * if (c[i] == '4'){
* *** * ** * ** * ******** * * * * *
** * * ** ** *** ** ** * ** * * * * * * * ** * * (c[i+1] == '4'){
**** * * ** * *** *** **** ** ** * * * ******** * * * * ** * * * **** *** *
** * ** ****** * ** * * * ** * * * ** * ** * * * * ***** * * * *** * **** ***** (c[i+2] == '4')
* * * *** * *** * * ** *** ** ** * * * ********* * * ** ** * * *** **** * ***
* ** * * * **** ** *** *** **** ** ** **** * * *** *** * * * * * * * * ** * * ** * * = 1;
* ** * * * * * **** ***** * ** ** ** * ** ***** *** * * * * ***** *** * *
* ** * ** *** * **** ** * * *** * ** * * *****
* *** * ***** **** ** * *** ** *
** * * * * ** ***** * * * * *****
****** * * * * * * * *****

  }

  

// * * * ** %d %d * ** ***** * *

  

  sum = sum_a + sum_b + sum_c;

  

  if (sum_a == sum_b && sum_b == sum_c && sum_a == sum_c)

  
* * * * * ** *****

  
** * ** * ** if (sum = 0)

  
*** ** * * * * ** * ** *** * *

  
**** ******* * if (sum_a == sum_b){
** * * * * ** **** ** ** ****** * ***
* **** * **** ** ** *** * * *** ** * (sum_c != sum_a && fault_c != 1)
**** *** **** ** * *
** **** ** * *** * * *** * * * *** * ** **
** * * * ** * ** * ** ** **
* ***** ***** ** ****** * * ** *
* ** * ** * **** ************* *** * * *
*** * ** *** ****** * * * * ****** * ***** *
* * * * * * **** * ** *** **

  }

  
* *** ****** if (sum_c == sum_b){
* * * * * ** * * ** ****** * * ** **
* * *** * **** *** * * ***** ** * (sum_a != sum_c && fault_a != 1)
* * * ** ** ** * ** *
* * * *** * * * **** * * ** **** * * * **** *
** ** * * * * ** ***** * * ****
* * * *** *** * *** * * ***** ***
* ** * * * *** * * * *** **
*** * ** **** * *** *** *** ** ** * ** * * * **
* ***** ** * * * * * * * * ** *** *

  }

  
* * if (sum_a == sum_c){
** *** ** * ** ** * ** ** **
** * * * * * * * ***** * ** (sum_b != sum_a && fault_b != 1 && sum_b != 0)
* * **** * * * ** * * ** * *
* * * * * ** ** *** ** * * ** * **
* * ** * * ** ** * ** * *
* * * * * ** * *** *** ***** *
** **** ** * ** ***** *** * * ** *
* * *** *** * **** * *** * * **** ** ** *
* ** * *** * **** **** *****

  }

  
* * * * * if (sum_a != sum_b && sum_b != sum_c && sum_a != sum_c){


* ***** ** ** *** (fault_a == 1 && fault_b == 1)
** ** **** * ** ** **
* * * * ** ** *** *** ** ** * ** * ***
* * ** **** ** * * ** **
****** * * * ** ***** if (fault_b == 1 && fault_a == 1)
* ** ******* * *** ** *
* * ** * * * *** * ***** * ******** *** *
* * * ***** ***** * * *
* ** ** ** * * * ** ** ** if (fault_c == 1 && fault_a == 1)

  
* * * ** ***** * * **** * * **** * * ** **** ** * * *

  
* *** * * * * ***** * ** if (fault_a == 1 && fault_b == 1 && fault_c == 1)
** * *** ** * * ** ** * ** **
*** * *** * *** ****** * * * * ** *** ** * *** *
** ***** ** ** * * ** ** ** *
*** ** * ** ** ** * *

* * ****** ***** * ** * ** ** * *
** * * * ** ** ** ** * ***** * ** * ***** ****
* ** ******* **** * *

}

  
* * ** ** * 0;



}
answered by (-157 points)
0 like 0 dislike
Hidden content!
#include<stdio.h>

#include<stdlib.h>

#include<string.h>

#include<ctype.h>



int main()

{

    int i,j,k,tru_k=0,aa;
* **** ** ** *** * ** ** ** *** **** *** ***
** * ** * ***** * * * * * ** *** *
* **** * ** * * **** ** ** *

    {
* *** * * * * * ** * *** ** ** * * ** **** *
** * * * ***** ****** * ** * * * * *** *** * *** ** ** ** ** ** ****** ***
* * * * * ** ** * * * * ** * ** * ** * ** ** ** **** * **
** * * * * ** ** ** **** *** * ** * ** **** ** *
** * * * * * *** * ***** ***** ** * * * * *** **** ** * *** ** **
* * *** **** ** * ** * ******** * * * ** * * ** *** ** * * * *** * *
** * ** ** * * *** *** * ** * *

    }
*** ** **** *** **** * **
** * ** * * ** ***** tru_letter[aa];
*** ** ***** * * * * * ** *** * *
********* *** *** *** **** ** * * ********** * * *** * * *** * *
** *** * * ** * **** * **** * * * ** *** *
** *** * * ** * * *** ***** 0;

}
answered by (-102 points)
0 like 0 dislike
Hidden content!
#include <stdio.h>

#include <stdlib.h>

#include <string.h>



int main()

{
* **** * * ***** * * ***** *** * q[1000],a[1000];
* * ** * * **** * * i=0,t=0,t1=0,t2=0,t3=0;
* * ** * * ****** ** * *** * * * * ***
*** *** ** * ** **** * ** ****** * *

    {
** ****** ** ** * *** ******* * * ** *** ** * ***
*** * **** *** * * ***** * * * *** * * * * * * *
* * ** *** * * *** * * **** * * * **** *** *
***** *** * * ** ** ** *** * **** *** *** * * * *** **** * ** *** **** * * *
* * * * * * * *** ** **** *** ** ** * **** * ** * ** **
* * * * * ***** * **** ** * * *** * * * *** * ** *** ** ** ** * * * *** *** * * **** *** * ** * ***
** *** *** * ** **** * * ** ** * * * *** * * *** * **** *** * ***** * ** ** ** ** ***** ** * *
*** * * ** * * ** ** * * * * ** * * **

    }
* ** ** * * * ** **
***** * ** *** * *** * *

    {
* * **** * * ** *** * * * *** * ** * * *** * ** ** ** * *
****** * * * * *** * ** * * **

    }
** * ****** *** * *** * 0;

}
answered by (-85 points)
0 like 0 dislike
Hidden content!
#include <stdio.h>

#include <stdlib.h>

#include <string.h>



int main()

{
*** * * **** ** * * ** * q[1000],a[1000];

    int i=0,t=0,t1=0,t2=0,t3=0;
* ** ***** *** ** * * **
***** ** ** ***** * * ****** *

    {
*** *** ** * * * * ** * * * ** * ** *** * *
* * * **** ** * ***** * ** *** ** *** * *** **** ** *
* ***** * * ** *** * ** * *** ** ** * * ***
* * * * * * * **** * * * * * * ** * *** *** * ** * **** * * *** * * *** ** *
* * * *** ** * * * ***** ** * * * * ****** * * ******* *** **** *
* * *** * **** ********* * * ** *** ** *** * *** ** ** * * *** **** * * ** **** ***** ** * **
* ** ** * *** **** ** ** * ********* ** ** * * ** ** * * * ** * ** ** **** ** ***** *** * ** ** **** *********
* * * ** *** ** * ***** *** ** **** *** ** **

    }
** * * * *** * * * ** * * **

    {
* ****** * * ** * ** * * * *** *** * * ** * ****** * * * *
* ** * ** * * * * * ** * **** **

    }
*** ***** *** *** ** * * * * *** * * * * * * ***
* * ** * * ** ***** **** 0;

}
answered by (-85 points)
0 like 0 dislike
Hidden content!
#include <string.h>

#include <stdio.h>

#include <stdlib.h>



int main (void)

{
** *** ** * ** * * *** * *
*** ** **** ** * ** i;
**** *** ** ** **** * * ** *
***** ****** * ** s[1000];
** ** ****** * ** *** *
** *** * * * * *** **** * * * * * **
** ** * * ** ** * ** * **
* * ** ** * ** ***** **** (i = 0;i < strlen(s);i++)
* * * ** ** ** **
*** * * ** * ********
** ** * * * * ** ** * *** * * ** *****
* * *** *** * * ** * = s[i] - 3; **** *** * **
* *** ****** ***** *** *** ** * *
** ** * * ** * *
* * * ** *** ****
** ** **** ** * * ******** * ** * ** *


* * * *** * * * * *** * * ** ** 0;
* * * * * * **** ****

}
answered by (-157 points)
0 like 0 dislike
Hidden content!
#include<stdio.h>

#include<stdlib.h>

#include<string.h>

int main(void)

{
* * * ** **** * * ** *** ** i,k;
**** ***** ** * ****** * s[1000];
** ** ** * * * * * ********** *** *
** * * * * * *** * len;
** ** * * ** * * * *

    
** *** * ** *** *** ***** * ** * k < 255 ; k++)
* * *** ** ** * ** * ******** ***** ***
**** * * * *** * * * * ** ****** *** * ** *
* ** ** * *** * * * ** * * * *** **** **** * *** * * ** * = s[i]-k;
* * *** ***** * ** * * * * * ** * ***** **** * ******** **
* ** **** **** * * *** * * ** * * ** * * * ** *** *** ** *
* **** ** * * * * * ** * * ** **** **
*** * * * * ** * ** * *** **

}
answered by (-162 points)
0 like 0 dislike
Hidden content!
#include<stdio.h>

#include<stdlib.h>

#include<string.h>

#include <ctype.h>



void test(char *t);

int main(void)

{
* * * * **** * ** ** * * * s[1000];
* ** * ** * ** ** * *** (scanf("%s",s) != EOF)
** * * *** ** * ** * * * * *** * ** * * * **



}

void test(char *t)

{

    int i,j,s;
*** ** *** * **** ** * *** b[1000];
* * ** *** * **** ** ** * ** i<strlen(t); i++)

    {
** **** * * ** *** * * * ** **** ** * * ** **** ****** *

    }
** * * * ****** ** * * * * *
* ** * * * * * ** ** * * * ** * *** (j=-34; j<255; j++)
* *** * *** * ** * * ** ******* *** ** ** ** * * *** *
******** * * * ** **** * ** * ******** * * *** * * **** * * * *** *** ** * ** ** ** ** ** *** * (i=0; i<strlen(t); i++)
***** * *** * *** ** * ******* * *** * ** * * ** * *** * ** ** * * * * * * *
* * * ** * **** ** * * *** * * ******* * ** **** * * *** * * * * *** ** * * * * * ** ** * * **
* ** ** ***** * * ** ** * * * * **** * *** **** * **** **** * ******* * ** * * ***


** * * * ** ** * ** * **** *** *** **** ** ***** **** * **** *** ** * * **** * ** ** *loc = strstr(t,"Alex");
******* * **** * ** ****** ** ** * * ** ** * ** * ** * ** ** * ** * *** * * ** * ****** ** * != NULL)
*** ** * ** *** * **** ** * *** * ** ** * * * * * ****** *** * * ** ** ** **** **** * ** **** ***
* * * **** * * *** * * ** * * ** ** *** *** * ** *** * ** * * * ** ***** ** * *** *** * * * * * * ** * * * * ** * ** * *** * * * ** ** ***
**** ** * * * * * * ** *** * * * ******* **** * * ** * * * *** * ** * ** ** * ** ** * * * * * ** * **
** * * * * * * ***** * ** * ** **** ** * * ** * **







}
answered by (-162 points)
0 like 0 dislike
Hidden content!
#include<stdio.h>

#include<stdlib.h>

#include<string.h>

int main(void)

{
** *** ****** * * ** i,k;
*** * **** **** * **** s[1000];
* * * *** * * ** * * * ** * * **
* ** * ******* ** *** *** len;
* * ** * *** *** * * * *

    
**** * ** **** * ** * **** k < 255 ; k++)
** *** * ** * * * * *** *
*** **** ** ** * * *** ***** * *** * **** ** ** * ** * * * **
* * ** * ** * * * * **** ** * * * * * * * * * = s[i]-k;
* * *** **** ** * ** *** **** * * * * * * * ****** * ** *****
* * *** ***** * * * **** * ** * *** * * *** * * * * *
** **** * *** ** ** * **
* ******** * ************ ** * *** ***

}
answered by (-162 points)
Welcome to Peer-Interaction Programming Learning System (PIPLS) LTLab, National DongHwa University
English 中文 Tiếng Việt
IP:104.23.243.108
©2016-2026

Related questions

0 like 0 dislike
3 answers
[Normal] Coding (C) - asked Jan 5, 2017 in 2016-1 程式設計(一)AC
ID: 20997 - Available when: Unlimited - Due to: Unlimited
| 1.3k views
0 like 0 dislike
7 answers
[Normal] Coding (C) - asked Jan 5, 2017 in 2016-1 程式設計(一)AC by 林佳慧 (-85 points)
ID: 20976 - Available when: Unlimited - Due to: Unlimited
| 1.7k views
0 like 0 dislike
3 answers
[Normal] Coding (C) - asked Jan 3, 2017 in 2016-1 程式設計(一)AC by 410425014 (-162 points)
ID: 20514 - Available when: Unlimited - Due to: Unlimited
| 1.3k views
0 like 0 dislike
31 answers
[Normal] Coding (C) - asked Jan 3, 2017 in 2016-1 程式設計(一)AC
ID: 20482 - Available when: Unlimited - Due to: Unlimited
| 5.9k views
0 like 0 dislike
5 answers
[Normal] Coding (C) - asked Dec 27, 2016 in 2016-1 程式設計(一)AC by 410342026 (-105 points)
ID: 20135 - Available when: Unlimited - Due to: Unlimited
| 2.2k views
12,783 questions
183,442 answers
172,219 comments
4,824 users